Skip to content

Commit

Permalink
Merge pull request #11233 from jingyih/unset_old_cluster_version_metrics
Browse files Browse the repository at this point in the history
etcdserver: unset old cluster version in metrics
  • Loading branch information
gyuho authored Oct 12, 2019
2 parents 0824b08 + 9c4194f commit f20daa5
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 @@ -573,6 +574,9 @@ func (c *RaftCluster) SetVersion(ver *semver.Version, onSet func(*zap.Logger, *s
if c.be != nil {
mustSaveClusterVersionToBackend(c.be, ver)
}
if oldVer != nil {
ClusterVersionMetrics.With(prometheus.Labels{"cluster_version": oldVer.String()}).Set(0)
}
ClusterVersionMetrics.With(prometheus.Labels{"cluster_version": ver.String()}).Set(1)
onSet(c.lg, ver)
}
Expand Down

0 comments on commit f20daa5

Please sign in to comment.