github.com/xmidt-org/webpa-common@v1.11.9/service/metrics.go (about) 1 package service 2 3 import ( 4 "github.com/xmidt-org/webpa-common/xmetrics" 5 ) 6 7 const ( 8 ErrorCount = "sd_error_count" 9 UpdateCount = "sd_update_count" 10 InstanceCount = "sd_instance_count" 11 LastErrorTimestamp = "sd_last_error_timestamp" 12 LastUpdateTimestamp = "sd_last_update_timestamp" 13 14 ServiceLabel = "service" 15 EventKeyLabel = "eventKey" 16 ) 17 18 // Metrics is the service discovery module function for metrics 19 func Metrics() []xmetrics.Metric { 20 return []xmetrics.Metric{ 21 { 22 Name: ErrorCount, 23 Type: "counter", 24 Help: "The total count of errors from the service discovery backend for a particular service", 25 LabelNames: []string{ServiceLabel, EventKeyLabel}, 26 }, 27 { 28 Name: UpdateCount, 29 Type: "counter", 30 Help: "The total count of updates from the service discovery backend for a particular service", 31 LabelNames: []string{ServiceLabel, EventKeyLabel}, 32 }, 33 { 34 Name: InstanceCount, 35 Type: "gauge", 36 Help: "The current number of service instances of a given type", 37 LabelNames: []string{ServiceLabel, EventKeyLabel}, 38 }, 39 { 40 Name: LastErrorTimestamp, 41 Type: "gauge", 42 Help: "The last time the service discovery backend sent an error for a given service", 43 LabelNames: []string{ServiceLabel, EventKeyLabel}, 44 }, 45 { 46 Name: LastUpdateTimestamp, 47 Type: "gauge", 48 Help: "The last time the service discovery backend sent updated instances for a given service", 49 LabelNames: []string{ServiceLabel, EventKeyLabel}, 50 }, 51 } 52 }