Port: change leader status metric name to active (#10245)

* change active node metric name

* comment to see if commit is fine

Co-authored-by: Hridoy Roy <hridoyroy@Hridoys-MacBook-Pro.local>
This commit is contained in:
Hridoy Roy 2020-10-29 10:30:45 -07:00 committed by GitHub
parent 4cc1c8aa75
commit f8a248ce48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 10 deletions

View File

@ -44,9 +44,9 @@ func (c *Core) metricsLoop(stopCh chan struct{}) {
// Refresh the standby gauge, on all nodes
if standby, _ := c.Standby(); standby {
c.metricSink.SetGaugeWithLabels([]string{"core", "leader"}, 0, nil)
c.metricSink.SetGaugeWithLabels([]string{"core", "active"}, 0, nil)
} else {
c.metricSink.SetGaugeWithLabels([]string{"core", "leader"}, 1, nil)
c.metricSink.SetGaugeWithLabels([]string{"core", "active"}, 1, nil)
}
// Refresh gauge metrics that are looped
@ -58,7 +58,7 @@ func (c *Core) metricsLoop(stopCh chan struct{}) {
// should trigger
continue
}
if c.perfStandby { // already have lock here, don't re-acquire
if c.perfStandby { // already have lock here, do not re-acquire
syncCounter(c)
} else {
err := c.saveCurrentRequestCounters(context.Background(), time.Now())

View File

@ -176,10 +176,10 @@ func TestLeaderReElectionMetrics(t *testing.T) {
t.Fatal("failed to unmarshal:", err)
}
for _, gauge := range data.Gauges {
if gauge.Name == "core.leader" {
if gauge.Name == "core.active" {
coreLeaderMetric = true
if gauge.Value != 1 {
t.Errorf("metric incorrectly reports leader status")
t.Errorf("metric incorrectly reports active status")
}
}
if gauge.Name == "core.unsealed" {
@ -216,10 +216,10 @@ func TestLeaderReElectionMetrics(t *testing.T) {
coreLeaderMetric = false
coreUnsealMetric = false
for _, gauge := range data.Gauges {
if gauge.Name == "core.leader" {
if gauge.Name == "core.active" {
coreLeaderMetric = true
if gauge.Value != 1 {
t.Errorf("metric incorrectly reports leader status")
t.Errorf("metric incorrectly reports active status")
}
}
if gauge.Name == "core.unsealed" {

View File

@ -562,7 +562,7 @@ func (c *Core) waitForLeadership(newLeaderCh chan func(), manualStepDownCh, stop
if err == nil {
c.standby = false
c.leaderUUID = uuid
c.metricSink.SetGaugeWithLabels([]string{"core", "leader"}, 1, nil)
c.metricSink.SetGaugeWithLabels([]string{"core", "active"}, 1, nil)
}
close(continueCh)
@ -610,7 +610,7 @@ func (c *Core) waitForLeadership(newLeaderCh chan func(), manualStepDownCh, stop
// Mark as standby
c.standby = true
c.leaderUUID = ""
c.metricSink.SetGaugeWithLabels([]string{"core", "leader"}, 0, nil)
c.metricSink.SetGaugeWithLabels([]string{"core", "active"}, 0, nil)
// Seal
if err := c.preSeal(); err != nil {

View File

@ -89,7 +89,7 @@ These metrics represent operational aspects of the running Vault instance.
| `vault.core.fetch_acl_and_token` | Duration of time taken by ACL and corresponding token entry fetches handled by Vault core | ms | summary |
| `vault.core.handle_request` | Duration of time taken by requests handled by Vault core | ms | summary |
| `vault.core.handle_login_request` | Duration of time taken by login requests handled by Vault core | ms | summary |
| `vault.core.leader` | Has value 1 when the vault node is leader, and 0 when node is in standby. | bool | gauge |
| `vault.core.active` | Has value 1 when the vault node is active, and 0 when node is in standby. | bool | gauge |
| `vault.core.leadership_setup_failed` | Duration of time taken by cluster leadership setup failures which have occurred in a highly available Vault cluster. This should be monitored and alerted on for overall cluster leadership status. | ms | summary |
| `vault.core.leadership_lost` | Duration of time taken by cluster leadership losses which have occurred in a highly available Vault cluster. This should be monitored and alerted on for overall cluster leadership status. | ms | summary |
| `vault.core.mount_table.num_entries` | Number of mounts in a particular mount table. This metric is labeled by table type (auth or logical) and whether or not the table is replicated (local or not) | objects | summary |