Skip to content

Commit

Permalink
etcdserver: unset old cluster version in metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
jingyih committed Oct 10, 2019
1 parent c606182 commit c46460b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions etcdserver/api/membership/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@ func (c *RaftCluster) SetVersion(ver *semver.Version, onSet func(*zap.Logger, *s
plog.Noticef("set the initial cluster version to %v", version.Cluster(ver.String()))
}
}
oldVer := c.version
c.version = ver
mustDetectDowngrade(c.lg, c.version)
if c.v2store != nil {
Expand All @@ -574,6 +575,9 @@ func (c *RaftCluster) SetVersion(ver *semver.Version, onSet func(*zap.Logger, *s
mustSaveClusterVersionToBackend(c.be, ver)
}
ClusterVersionMetrics.With(prometheus.Labels{"cluster_version": ver.String()}).Set(1)
if oldVer != nil {
ClusterVersionMetrics.With(prometheus.Labels{"cluster_version": oldVer.String()}).Set(0)
}
onSet(c.lg, ver)
}

Expand Down

0 comments on commit c46460b

Please sign in to comment.