add the service name in the agent rather than in the definitions themselves

This commit is contained in:
Kit Patella 2020-11-13 13:18:04 -08:00
parent 9533372ded
commit b486c1bce8
19 changed files with 141 additions and 119 deletions

View File

@ -14,115 +14,115 @@ import (
// TODO(kit): Add help strings for each // TODO(kit): Add help strings for each
var CatalogCounters = []prometheus.CounterDefinition{ var CatalogCounters = []prometheus.CounterDefinition{
{ {
Name: []string{"consul", "client", "api", "catalog_register"}, Name: []string{"client", "api", "catalog_register"},
Help: "Increments whenever a Consul agent receives a catalog register request.", Help: "Increments whenever a Consul agent receives a catalog register request.",
}, },
{ {
Name: []string{"consul", "client", "rpc", "error", "catalog_register"}, Name: []string{"client", "rpc", "error", "catalog_register"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "client", "api", "success", "catalog_register"}, Name: []string{"client", "api", "success", "catalog_register"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "client", "api", "catalog_deregister"}, Name: []string{"client", "api", "catalog_deregister"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "client", "api", "catalog_datacenters"}, Name: []string{"client", "api", "catalog_datacenters"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "client", "rpc", "error", "catalog_deregister"}, Name: []string{"client", "rpc", "error", "catalog_deregister"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "client", "api", "success", "catalog_nodes"}, Name: []string{"client", "api", "success", "catalog_nodes"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "client", "rpc", "error", "catalog_nodes"}, Name: []string{"client", "rpc", "error", "catalog_nodes"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "client", "api", "success", "catalog_deregister"}, Name: []string{"client", "api", "success", "catalog_deregister"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "client", "rpc", "error", "catalog_datacenters"}, Name: []string{"client", "rpc", "error", "catalog_datacenters"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "client", "api", "success", "catalog_datacenters"}, Name: []string{"client", "api", "success", "catalog_datacenters"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "client", "api", "catalog_nodes"}, Name: []string{"client", "api", "catalog_nodes"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "client", "api", "catalog_services"}, Name: []string{"client", "api", "catalog_services"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "client", "rpc", "error", "catalog_services"}, Name: []string{"client", "rpc", "error", "catalog_services"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "client", "api", "success", "catalog_services"}, Name: []string{"client", "api", "success", "catalog_services"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "client", "api", "catalog_service_nodes"}, Name: []string{"client", "api", "catalog_service_nodes"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "client", "rpc", "error", "catalog_service_nodes"}, Name: []string{"client", "rpc", "error", "catalog_service_nodes"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "client", "api", "success", "catalog_service_nodes"}, Name: []string{"client", "api", "success", "catalog_service_nodes"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "client", "api", "error", "catalog_service_nodes"}, Name: []string{"client", "api", "error", "catalog_service_nodes"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "client", "api", "catalog_node_services"}, Name: []string{"client", "api", "catalog_node_services"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "client", "api", "success", "catalog_node_services"}, Name: []string{"client", "api", "success", "catalog_node_services"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "client", "rpc", "error", "catalog_node_services"}, Name: []string{"client", "rpc", "error", "catalog_node_services"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "client", "api", "catalog_node_service_list"}, Name: []string{"client", "api", "catalog_node_service_list"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "client", "rpc", "error", "catalog_node_service_list"}, Name: []string{"client", "rpc", "error", "catalog_node_service_list"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "client", "api", "success", "catalog_node_service_list"}, Name: []string{"client", "api", "success", "catalog_node_service_list"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "client", "api", "catalog_gateway_services"}, Name: []string{"client", "api", "catalog_gateway_services"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "client", "rpc", "error", "catalog_gateway_services"}, Name: []string{"client", "rpc", "error", "catalog_gateway_services"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "client", "api", "success", "catalog_gateway_services"}, Name: []string{"client", "api", "success", "catalog_gateway_services"},
Help: "", Help: "",
}, },
} }

View File

@ -18,26 +18,26 @@ import (
var ACLCounters = []prometheus.CounterDefinition{ var ACLCounters = []prometheus.CounterDefinition{
{ {
Name: []string{"consul", "acl", "token", "cache_hit"}, Name: []string{"acl", "token", "cache_hit"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "acl", "token", "cache_miss"}, Name: []string{"acl", "token", "cache_miss"},
Help: "", Help: "",
}, },
} }
var ACLSummaries = []prometheus.SummaryDefinition{ var ACLSummaries = []prometheus.SummaryDefinition{
{ {
Name: []string{"consul", "acl", "resolveTokenLegacy"}, Name: []string{"acl", "resolveTokenLegacy"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "acl", "ResolveToken"}, Name: []string{"acl", "ResolveToken"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "acl", "ResolveTokenToIdentity"}, Name: []string{"acl", "ResolveTokenToIdentity"},
Help: "", Help: "",
}, },
} }

View File

@ -33,67 +33,67 @@ const (
var ACLEndpointSummaries = []prometheus.SummaryDefinition{ var ACLEndpointSummaries = []prometheus.SummaryDefinition{
{ {
Name: []string{"consul", "acl", "token", "clone"}, Name: []string{"acl", "token", "clone"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "acl", "token", "upsert"}, Name: []string{"acl", "token", "upsert"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "acl", "token", "delete"}, Name: []string{"acl", "token", "delete"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "acl", "policy", "upsert"}, Name: []string{"acl", "policy", "upsert"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "acl", "policy", "delete"}, Name: []string{"acl", "policy", "delete"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "acl", "policy", "delete"}, Name: []string{"acl", "policy", "delete"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "acl", "role", "upsert"}, Name: []string{"acl", "role", "upsert"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "acl", "role", "delete"}, Name: []string{"acl", "role", "delete"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "acl", "bindingrule", "upsert"}, Name: []string{"acl", "bindingrule", "upsert"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "acl", "bindingrule", "delete"}, Name: []string{"acl", "bindingrule", "delete"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "acl", "authmethod", "upsert"}, Name: []string{"acl", "authmethod", "upsert"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "acl", "authmethod", "delete"}, Name: []string{"acl", "authmethod", "delete"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "acl", "login"}, Name: []string{"acl", "login"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "acl", "login"}, Name: []string{"acl", "login"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "acl", "logout"}, Name: []string{"acl", "logout"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "acl", "logout"}, Name: []string{"acl", "logout"},
Help: "", Help: "",
}, },
} }

View File

@ -15,11 +15,11 @@ import (
var AutopilotGauges = []prometheus.GaugeDefinition{ var AutopilotGauges = []prometheus.GaugeDefinition{
{ {
Name: []string{"consul", "autopilot", "failure_tolerance"}, Name: []string{"autopilot", "failure_tolerance"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "autopilot", "healthy"}, Name: []string{"autopilot", "healthy"},
Help: "This tracks the overall health of the local server cluster. 1 if all servers are healthy, 0 if one or more are unhealthy.", Help: "This tracks the overall health of the local server cluster. 1 if all servers are healthy, 0 if one or more are unhealthy.",
}, },
} }

View File

@ -20,46 +20,46 @@ import (
var CatalogCounters = []prometheus.CounterDefinition{ var CatalogCounters = []prometheus.CounterDefinition{
{ {
Name: []string{"consul", "catalog", "service", "query"}, Name: []string{"catalog", "service", "query"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "catalog", "connect", "query"}, Name: []string{"catalog", "connect", "query"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "catalog", "service", "query-tag"}, Name: []string{"catalog", "service", "query-tag"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "catalog", "connect", "query-tag"}, Name: []string{"catalog", "connect", "query-tag"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "catalog", "service", "query-tags"}, Name: []string{"catalog", "service", "query-tags"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "catalog", "connect", "query-tags"}, Name: []string{"catalog", "connect", "query-tags"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "catalog", "service", "not-found"}, Name: []string{"catalog", "service", "not-found"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "catalog", "connect", "not-found"}, Name: []string{"catalog", "connect", "not-found"},
Help: "", Help: "",
}, },
} }
var CatalogSummaries = []prometheus.SummaryDefinition{ var CatalogSummaries = []prometheus.SummaryDefinition{
{ {
Name: []string{"consul", "catalog", "deregister"}, Name: []string{"catalog", "deregister"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "catalog", "register"}, Name: []string{"catalog", "register"},
Help: "", Help: "",
}, },
} }

View File

@ -24,15 +24,15 @@ import (
var ClientCounters = []prometheus.CounterDefinition{ var ClientCounters = []prometheus.CounterDefinition{
{ {
Name: []string{"consul", "client", "rpc"}, Name: []string{"client", "rpc"},
Help: "Increments whenever a Consul agent in client mode makes an RPC request to a Consul server.", Help: "Increments whenever a Consul agent in client mode makes an RPC request to a Consul server.",
}, },
{ {
Name: []string{"consul", "client", "rpc", "exceeded"}, Name: []string{"client", "rpc", "exceeded"},
Help: "Increments whenever a Consul agent in client mode makes an RPC request to a Consul server gets rate limited by that agent's limits configuration.", Help: "Increments whenever a Consul agent in client mode makes an RPC request to a Consul server gets rate limited by that agent's limits configuration.",
}, },
{ {
Name: []string{"consul", "client", "rpc", "failed"}, Name: []string{"client", "rpc", "failed"},
Help: "Increments whenever a Consul agent in client mode makes an RPC request to a Consul server and fails.", Help: "Increments whenever a Consul agent in client mode makes an RPC request to a Consul server and fails.",
}, },
} }

View File

@ -16,27 +16,27 @@ import (
var ConfigSummaries = []prometheus.SummaryDefinition{ var ConfigSummaries = []prometheus.SummaryDefinition{
{ {
Name: []string{"consul", "config_entry", "apply"}, Name: []string{"config_entry", "apply"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "config_entry", "get"}, Name: []string{"config_entry", "get"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "config_entry", "list"}, Name: []string{"config_entry", "list"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "config_entry", "listAll"}, Name: []string{"config_entry", "listAll"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "config_entry", "delete"}, Name: []string{"config_entry", "delete"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "config_entry", "resolve_service_config"}, Name: []string{"config_entry", "resolve_service_config"},
Help: "", Help: "",
}, },
} }

View File

@ -15,19 +15,19 @@ import (
var FederationStateSummaries = []prometheus.SummaryDefinition{ var FederationStateSummaries = []prometheus.SummaryDefinition{
{ {
Name: []string{"consul", "federation_state", "apply"}, Name: []string{"federation_state", "apply"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "federation_state", "get"}, Name: []string{"federation_state", "get"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "federation_state", "list"}, Name: []string{"federation_state", "list"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "federation_state", "list_mesh_gateways"}, Name: []string{"federation_state", "list_mesh_gateways"},
Help: "", Help: "",
}, },
} }

View File

@ -22,6 +22,10 @@ var IntentionSummaries = []prometheus.SummaryDefinition{
Name: []string{"consul", "intention", "apply"}, Name: []string{"consul", "intention", "apply"},
Help: "", Help: "",
}, },
{
Name: []string{"intention", "apply"},
Help: "",
},
} }
var ( var (
@ -260,7 +264,6 @@ func (s *Intention) Apply(
if done, err := s.srv.ForwardRPC("Intention.Apply", args, args, reply); done { if done, err := s.srv.ForwardRPC("Intention.Apply", args, args, reply); done {
return err return err
} }
// TODO(Kit): Why do we have summaries for intentions both with and without the consul namespace?
defer metrics.MeasureSince([]string{"consul", "intention", "apply"}, time.Now()) defer metrics.MeasureSince([]string{"consul", "intention", "apply"}, time.Now())
defer metrics.MeasureSince([]string{"intention", "apply"}, time.Now()) defer metrics.MeasureSince([]string{"intention", "apply"}, time.Now())

View File

@ -17,7 +17,7 @@ import (
var KVSummaries = []prometheus.SummaryDefinition{ var KVSummaries = []prometheus.SummaryDefinition{
{ {
Name: []string{"consul", "kvs", "apply"}, Name: []string{"kvs", "apply"},
Help: "This measures the time it takes to complete an update to the KV store.", Help: "This measures the time it takes to complete an update to the KV store.",
}, },
} }

View File

@ -18,19 +18,19 @@ import (
var PreparedQuerySummaries = []prometheus.SummaryDefinition{ var PreparedQuerySummaries = []prometheus.SummaryDefinition{
{ {
Name: []string{"consul", "prepared-query", "apply"}, Name: []string{"prepared-query", "apply"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "prepared-query", "explain"}, Name: []string{"prepared-query", "explain"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "prepared-query", "execute"}, Name: []string{"prepared-query", "execute"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "prepared-query", "execute_remote"}, Name: []string{"prepared-query", "execute_remote"},
Help: "", Help: "",
}, },
} }

View File

@ -34,41 +34,41 @@ import (
var RPCCounters = []prometheus.CounterDefinition{ var RPCCounters = []prometheus.CounterDefinition{
{ {
Name: []string{"consul", "rpc", "accept_conn"}, Name: []string{"rpc", "accept_conn"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "rpc", "raft_handoff"}, Name: []string{"rpc", "raft_handoff"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "rpc", "request_error"}, Name: []string{"rpc", "request_error"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "rpc", "request"}, Name: []string{"rpc", "request"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "rpc", "cross-dc"}, Name: []string{"rpc", "cross-dc"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "rpc", "query"}, Name: []string{"rpc", "query"},
Help: "", Help: "",
}, },
} }
var RPCGauges = []prometheus.GaugeDefinition{ var RPCGauges = []prometheus.GaugeDefinition{
{ {
Name: []string{"consul", "rpc", "queries_blocking"}, Name: []string{"rpc", "queries_blocking"},
Help: "", Help: "",
}, },
} }
var RPCSummaries = []prometheus.SummaryDefinition{ var RPCSummaries = []prometheus.SummaryDefinition{
{ {
Name: []string{"consul", "rpc", "consistentRead"}, Name: []string{"rpc", "consistentRead"},
Help: "", Help: "",
}, },
} }

View File

@ -12,22 +12,22 @@ import (
var SessionGauges = []prometheus.GaugeDefinition{ var SessionGauges = []prometheus.GaugeDefinition{
{ {
Name: []string{"consul", "session_ttl", "active"}, Name: []string{"session_ttl", "active"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "raft", "applied_index"}, Name: []string{"raft", "applied_index"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "raft", "last_index"}, Name: []string{"raft", "last_index"},
Help: "", Help: "",
}, },
} }
var SessionSummaries = []prometheus.SummaryDefinition{ var SessionSummaries = []prometheus.SummaryDefinition{
{ {
Name: []string{"consul", "session_ttl", "invalidate"}, Name: []string{"session_ttl", "invalidate"},
Help: "", Help: "",
}, },
} }

View File

@ -14,11 +14,11 @@ import (
var TxnSummaries = []prometheus.SummaryDefinition{ var TxnSummaries = []prometheus.SummaryDefinition{
{ {
Name: []string{"consul", "txn", "apply"}, Name: []string{"txn", "apply"},
Help: "This measures the time spent applying a transaction operation.", Help: "This measures the time spent applying a transaction operation.",
}, },
{ {
Name: []string{"consul", "txn", "read"}, Name: []string{"txn", "read"},
Help: "", Help: "",
}, },
} }

View File

@ -15,15 +15,15 @@ import (
var Gauges = []prometheus.GaugeDefinition{ var Gauges = []prometheus.GaugeDefinition{
{ {
Name: []string{"consul", "state", "nodes"}, Name: []string{"state", "nodes"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "state", "services"}, Name: []string{"state", "services"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "state", "service_instances"}, Name: []string{"state", "service_instances"},
Help: "", Help: "",
}, },
} }

View File

@ -13,37 +13,37 @@ import (
var defaultMetrics = metrics.Default() var defaultMetrics = metrics.Default()
var StatsGauges = []prometheus.GaugeDefinition{ var StatsGauges = []prometheus.GaugeDefinition{
{ {
Name: []string{"consul", "grpc", "server", "connections"}, Name: []string{"grpc", "server", "connections"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "grpc", "client", "connections"}, Name: []string{"grpc", "client", "connections"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "grpc", "server", "streams"}, Name: []string{"grpc", "server", "streams"},
Help: "", Help: "",
}, },
} }
var StatsCounters = []prometheus.CounterDefinition{ var StatsCounters = []prometheus.CounterDefinition{
{ {
Name: []string{"consul", "grpc", "client", "request", "count"}, Name: []string{"grpc", "client", "request", "count"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "grpc", "server", "request", "count"}, Name: []string{"grpc", "server", "request", "count"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "grpc", "client", "connection", "count"}, Name: []string{"grpc", "client", "connection", "count"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "grpc", "server", "connection", "count"}, Name: []string{"grpc", "server", "connection", "count"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "grpc", "server", "stream", "count"}, Name: []string{"grpc", "server", "stream", "count"},
Help: "", Help: "",
}, },
} }

View File

@ -34,7 +34,7 @@ import (
var HTTPSummaries = []prometheus.SummaryDefinition{ var HTTPSummaries = []prometheus.SummaryDefinition{
{ {
Name: []string{"consul", "api", "http"}, Name: []string{"api", "http"},
Help: "", Help: "",
}, },
} }

View File

@ -22,23 +22,23 @@ import (
var StateCounters = []prometheus.CounterDefinition{ var StateCounters = []prometheus.CounterDefinition{
{ {
Name: []string{"consul", "acl", "blocked", "service", "deregistration"}, Name: []string{"acl", "blocked", "service", "deregistration"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "acl", "blocked", "check", "deregistration"}, Name: []string{"acl", "blocked", "check", "deregistration"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "acl", "blocked", "service", "registration"}, Name: []string{"acl", "blocked", "service", "registration"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "acl", "blocked", "check", "registration"}, Name: []string{"acl", "blocked", "check", "registration"},
Help: "", Help: "",
}, },
{ {
Name: []string{"consul", "acl", "blocked", "node", "registration"}, Name: []string{"acl", "blocked", "node", "registration"},
Help: "", Help: "",
}, },
} }

View File

@ -185,6 +185,7 @@ func registerWithGRPC(b grpcresolver.Builder) {
// getPrometheusDefs reaches into every slice of prometheus defs we've defined in each part of the agent, and appends // getPrometheusDefs reaches into every slice of prometheus defs we've defined in each part of the agent, and appends
// all of our slices into one nice slice of definitions per metric type for the Consul agent to pass to go-metrics. // all of our slices into one nice slice of definitions per metric type for the Consul agent to pass to go-metrics.
func getPrometheusDefs() lib.PrometheusDefs { func getPrometheusDefs() lib.PrometheusDefs {
serviceName := []string{"consul"}
var gauges = [][]prometheus.GaugeDefinition{ var gauges = [][]prometheus.GaugeDefinition{
consul.AutopilotGauges, consul.AutopilotGauges,
consul.RPCGauges, consul.RPCGauges,
@ -194,7 +195,13 @@ func getPrometheusDefs() lib.PrometheusDefs {
} }
var gaugeDefs []prometheus.GaugeDefinition var gaugeDefs []prometheus.GaugeDefinition
for _, g := range gauges { for _, g := range gauges {
gaugeDefs = append(gaugeDefs, g...) // Set Consul to each definition's namespace
var withService []prometheus.GaugeDefinition
for _, gauge := range g {
gauge.Name = append(serviceName, gauge.Name...)
withService = append(withService, gauge)
}
gaugeDefs = append(gaugeDefs, withService...)
} }
raftCounters := []prometheus.CounterDefinition{ raftCounters := []prometheus.CounterDefinition{
@ -202,15 +209,15 @@ func getPrometheusDefs() lib.PrometheusDefs {
// package within. In the mean time, we're going to define them here because it's important that they're always // package within. In the mean time, we're going to define them here because it's important that they're always
// present for Consul users setting up dashboards. // present for Consul users setting up dashboards.
{ {
Name: []string{"consul", "raft", "apply"}, Name: []string{"raft", "apply"},
Help: "This counts the number of Raft transactions occurring over the interval.", Help: "This counts the number of Raft transactions occurring over the interval.",
}, },
{ {
Name: []string{"consul", "raft", "state", "candidate"}, Name: []string{"raft", "state", "candidate"},
Help: "This increments whenever a Consul server starts an election.", Help: "This increments whenever a Consul server starts an election.",
}, },
{ {
Name: []string{"consul", "raft", "state", "leader"}, Name: []string{"raft", "state", "leader"},
Help: "This increments whenever a Consul server becomes a leader.", Help: "This increments whenever a Consul server becomes a leader.",
}, },
} }
@ -227,7 +234,13 @@ func getPrometheusDefs() lib.PrometheusDefs {
} }
var counterDefs []prometheus.CounterDefinition var counterDefs []prometheus.CounterDefinition
for _, c := range counters { for _, c := range counters {
counterDefs = append(counterDefs, c...) // Set Consul to each definition's namespace
var withService []prometheus.CounterDefinition
for _, counter := range c {
counter.Name = append(serviceName, counter.Name...)
withService = append(withService, counter)
}
counterDefs = append(counterDefs, withService...)
} }
raftSummaries := []prometheus.SummaryDefinition{ raftSummaries := []prometheus.SummaryDefinition{
@ -235,11 +248,11 @@ func getPrometheusDefs() lib.PrometheusDefs {
// package within. In the mean time, we're going to define them here because it's important that they're always // package within. In the mean time, we're going to define them here because it's important that they're always
// present for Consul users setting up dashboards. // present for Consul users setting up dashboards.
{ {
Name: []string{"consul", "raft", "commitTime"}, Name: []string{"raft", "commitTime"},
Help: "This measures the time it takes to commit a new entry to the Raft log on the leader.", Help: "This measures the time it takes to commit a new entry to the Raft log on the leader.",
}, },
{ {
Name: []string{"consul", "raft", "leader", "lastContact"}, Name: []string{"raft", "leader", "lastContact"},
Help: "Measures the time since the leader was last able to contact the follower nodes when checking its leader lease.", Help: "Measures the time since the leader was last able to contact the follower nodes when checking its leader lease.",
}, },
} }
@ -260,7 +273,13 @@ func getPrometheusDefs() lib.PrometheusDefs {
} }
var summaryDefs []prometheus.SummaryDefinition var summaryDefs []prometheus.SummaryDefinition
for _, s := range summaries { for _, s := range summaries {
summaryDefs = append(summaryDefs, s...) // Set Consul to each definition's namespace
var withService []prometheus.SummaryDefinition
for _, summary := range s {
summary.Name = append(serviceName, summary.Name...)
withService = append(withService, summary)
}
summaryDefs = append(summaryDefs, withService...)
} }
return lib.PrometheusDefs{ return lib.PrometheusDefs{