Skip to content

Commit

Permalink
correct service node category
Browse files Browse the repository at this point in the history
- service node should be placed into "Service" category on dashboard

Change-Id: I3fac52f362523b82c7bed0ec79594685535cec9f
  • Loading branch information
Chunjie Zhu committed Jul 13, 2012
1 parent 0c661b7 commit 6b6b13d
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion health_monitor/lib/health_monitor/events/heartbeat.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ class Heartbeat < Base


CORE_JOBS = Set.new(%w(cloud_controller dea health_manager nats router stager vcap_redis)) CORE_JOBS = Set.new(%w(cloud_controller dea health_manager nats router stager vcap_redis))


SERVICE_JOBS_PREFIXES = %w(mysql mongodb redis rabbit postgresql vblob).join("|")
SERVICE_JOBS_GATEWAY_REGEX = /(#{SERVICE_JOBS_PREFIXES})_gateway$/i
SERVICE_JOBS_NODE_REGEX = /(#{SERVICE_JOBS_PREFIXES})_node(.*)/i

SERVICE_AUXILIARY_JOBS = Set.new(%w(serialization_data_server backup_manager)) SERVICE_AUXILIARY_JOBS = Set.new(%w(serialization_data_server backup_manager))


attr_reader :metrics attr_reader :metrics
Expand Down Expand Up @@ -109,7 +113,18 @@ def guess_role


return "service" if SERVICE_AUXILIARY_JOBS.include?(@job.to_s.downcase) return "service" if SERVICE_AUXILIARY_JOBS.include?(@job.to_s.downcase)


if @job.to_s =~ /(_node$|_gateway$|service)/i # job name prefixed by "service"
if @job.to_s.downcase =~ /^service/i
return "service"
end

# job name suffixed by "_gateway"
if @job.to_s.downcase =~ SERVICE_JOBS_GATEWAY_REGEX
return "service"
end

# job name contains "_node"
if @job.to_s.downcase =~ SERVICE_JOBS_NODE_REGEX
return "service" return "service"
end end


Expand Down

0 comments on commit 6b6b13d

Please sign in to comment.