Add prometheus guage definitions for replication metrics. (#10109)

This commit is contained in:
Matt Keeler 2021-04-23 17:05:33 -04:00 committed by GitHub
parent 8b20491a79
commit 6c639be8ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 53 additions and 0 deletions

View File

@ -7,6 +7,7 @@ import (
"time"
metrics "github.com/armon/go-metrics"
"github.com/armon/go-metrics/prometheus"
"github.com/hashicorp/go-hclog"
"golang.org/x/time/rate"
@ -14,6 +15,57 @@ import (
"github.com/hashicorp/consul/logging"
)
var ReplicationGauges = []prometheus.GaugeDefinition{
{
Name: []string{"leader", "replication", "acl-policies", "status"},
Help: "Tracks the current health of ACL policy replication on the leader",
},
{
Name: []string{"leader", "replication", "acl-policies", "index"},
Help: "Tracks the index of ACL policies in the primary that the secondary has successfully replicated",
},
{
Name: []string{"leader", "replication", "acl-tokens", "status"},
Help: "Tracks the current health of ACL token replication on the leader",
},
{
Name: []string{"leader", "replication", "acl-tokens", "index"},
Help: "Tracks the index of ACL tokens in the primary that the secondary has successfully replicated",
},
{
Name: []string{"leader", "replication", "acl-roles", "status"},
Help: "Tracks the current health of ACL role replication on the leader",
},
{
Name: []string{"leader", "replication", "acl-roles", "index"},
Help: "Tracks the index of ACL roles in the primary that the secondary has successfully replicated",
},
{
Name: []string{"leader", "replication", "config-entries", "status"},
Help: "Tracks the current health of config entry replication on the leader",
},
{
Name: []string{"leader", "replication", "config-entries", "index"},
Help: "Tracks the index of config entries in the primary that the secondary has successfully replicated",
},
{
Name: []string{"leader", "replication", "federation-state", "status"},
Help: "Tracks the current health of federation state replication on the leader",
},
{
Name: []string{"leader", "replication", "federation-state", "index"},
Help: "Tracks the index of federation states in the primary that the secondary has successfully replicated",
},
{
Name: []string{"leader", "replication", "namespaces", "status"},
Help: "Tracks the current health of federation state replication on the leader",
},
{
Name: []string{"leader", "replication", "namespaces", "index"},
Help: "Tracks the index of federation states in the primary that the secondary has successfully replicated",
},
}
const (
// replicationMaxRetryWait is the maximum number of seconds to wait between
// failed blocking queries when backing off.

View File

@ -202,6 +202,7 @@ func getPrometheusDefs(cfg lib.TelemetryConfig) ([]prometheus.GaugeDefinition, [
consul.SessionGauges,
grpc.StatsGauges,
usagemetrics.Gauges,
consul.ReplicationGauges,
Gauges,
}
// Flatten definitions