Skip to content

Commit

Permalink
Merge pull request #11255 from jingyih/automated-cherry-pick-of-#11233-
Browse files Browse the repository at this point in the history
…#11254-upstream-release-3.4

Automated cherry pick of #11233 #11254 on release 3.4
  • Loading branch information
gyuho authored Oct 15, 2019
2 parents c3dc994 + b67862c commit b3329eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion 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,7 +574,10 @@ func (c *RaftCluster) SetVersion(ver *semver.Version, onSet func(*zap.Logger, *s
if c.be != nil {
mustSaveClusterVersionToBackend(c.be, ver)
}
ClusterVersionMetrics.With(prometheus.Labels{"cluster_version": ver.String()}).Set(1)
if oldVer != nil {
ClusterVersionMetrics.With(prometheus.Labels{"cluster_version": version.Cluster(oldVer.String())}).Set(0)
}
ClusterVersionMetrics.With(prometheus.Labels{"cluster_version": version.Cluster(ver.String())}).Set(1)
onSet(c.lg, ver)
}

Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func metricsTest(cx ctlCtx) {
{"/metrics", fmt.Sprintf("etcd_debugging_mvcc_keys_total 1")},
{"/metrics", fmt.Sprintf("etcd_mvcc_delete_total 3")},
{"/metrics", fmt.Sprintf(`etcd_server_version{server_version="%s"} 1`, version.Version)},
{"/metrics", fmt.Sprintf(`etcd_cluster_version{cluster_version="%s"} 1`, version.Cluster(version.Version)+".0")},
{"/metrics", fmt.Sprintf(`etcd_cluster_version{cluster_version="%s"} 1`, version.Cluster(version.Version))},
{"/health", `{"health":"true"}`},
} {
i++
Expand Down

0 comments on commit b3329eb

Please sign in to comment.