mirror of https://github.com/status-im/consul.git
fix: only add prom autopilot gauges to servers (#11241)
Signed-off-by: FFMMM <FFMMM@users.noreply.github.com>
This commit is contained in:
parent
c6906b4d37
commit
62980ffaa2
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:bug
|
||||||
|
telemetry: Consul Clients no longer emit Autopilot metrics.
|
||||||
|
```
|
|
@ -83,7 +83,8 @@ func NewBaseDeps(configLoader ConfigLoader, logOut io.Writer) (BaseDeps, error)
|
||||||
return d, fmt.Errorf("failed to setup node ID: %w", err)
|
return d, fmt.Errorf("failed to setup node ID: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
gauges, counters, summaries := getPrometheusDefs(cfg.Telemetry)
|
isServer := result.RuntimeConfig.ServerMode
|
||||||
|
gauges, counters, summaries := getPrometheusDefs(cfg.Telemetry, isServer)
|
||||||
cfg.Telemetry.PrometheusOpts.GaugeDefinitions = gauges
|
cfg.Telemetry.PrometheusOpts.GaugeDefinitions = gauges
|
||||||
cfg.Telemetry.PrometheusOpts.CounterDefinitions = counters
|
cfg.Telemetry.PrometheusOpts.CounterDefinitions = counters
|
||||||
cfg.Telemetry.PrometheusOpts.SummaryDefinitions = summaries
|
cfg.Telemetry.PrometheusOpts.SummaryDefinitions = summaries
|
||||||
|
@ -187,7 +188,7 @@ func newConnPool(config *config.RuntimeConfig, logger hclog.Logger, tls *tlsutil
|
||||||
|
|
||||||
// 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(cfg lib.TelemetryConfig) ([]prometheus.GaugeDefinition, []prometheus.CounterDefinition, []prometheus.SummaryDefinition) {
|
func getPrometheusDefs(cfg lib.TelemetryConfig, isServer bool) ([]prometheus.GaugeDefinition, []prometheus.CounterDefinition, []prometheus.SummaryDefinition) {
|
||||||
// TODO: "raft..." metrics come from the raft lib and we should migrate these to a telemetry
|
// TODO: "raft..." metrics come from the raft lib and we should migrate these to a telemetry
|
||||||
// package within. In the mean time, we're going to define a few here because they're key to monitoring Consul.
|
// package within. In the mean time, we're going to define a few here because they're key to monitoring Consul.
|
||||||
raftGauges := []prometheus.GaugeDefinition{
|
raftGauges := []prometheus.GaugeDefinition{
|
||||||
|
@ -204,7 +205,6 @@ func getPrometheusDefs(cfg lib.TelemetryConfig) ([]prometheus.GaugeDefinition, [
|
||||||
// Build slice of slices for all gauge definitions
|
// Build slice of slices for all gauge definitions
|
||||||
var gauges = [][]prometheus.GaugeDefinition{
|
var gauges = [][]prometheus.GaugeDefinition{
|
||||||
cache.Gauges,
|
cache.Gauges,
|
||||||
consul.AutopilotGauges,
|
|
||||||
consul.RPCGauges,
|
consul.RPCGauges,
|
||||||
consul.SessionGauges,
|
consul.SessionGauges,
|
||||||
grpc.StatsGauges,
|
grpc.StatsGauges,
|
||||||
|
@ -216,6 +216,11 @@ func getPrometheusDefs(cfg lib.TelemetryConfig) ([]prometheus.GaugeDefinition, [
|
||||||
raftGauges,
|
raftGauges,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(ffmmm): conditionally add only leader specific metrics to gauges, counters, summaries, etc
|
||||||
|
if isServer {
|
||||||
|
gauges = append(gauges, consul.AutopilotGauges)
|
||||||
|
}
|
||||||
|
|
||||||
// Flatten definitions
|
// Flatten definitions
|
||||||
// NOTE(kit): Do we actually want to create a set here so we can ensure definition names are unique?
|
// NOTE(kit): Do we actually want to create a set here so we can ensure definition names are unique?
|
||||||
var gaugeDefs []prometheus.GaugeDefinition
|
var gaugeDefs []prometheus.GaugeDefinition
|
||||||
|
|
Loading…
Reference in New Issue