Permalink
Browse files

correct service node category

- service node should be placed into "Service" category on dashboard

Change-Id: I3fac52f362523b82c7bed0ec79594685535cec9f
  • Loading branch information...
1 parent 0c661b7 commit 6b6b13d90e0eb4933ca9c90aed8439d80cca286a Chunjie Zhu committed Jul 3, 2012
Showing with 16 additions and 1 deletion.
  1. +16 −1 health_monitor/lib/health_monitor/events/heartbeat.rb
@@ -4,6 +4,10 @@ class Heartbeat < Base
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))
attr_reader :metrics
@@ -109,7 +113,18 @@ def guess_role
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"
end

0 comments on commit 6b6b13d

Please sign in to comment.