enhance: use effective version in banner and metrics BuildInfo label

Previously, the startup banner and milvus_build_info Prometheus metric
always used the hardcoded semver from common.Version (e.g. "2.6.6"),
even for dev builds. This made it impossible to distinguish dev builds
from release builds in logs and monitoring.

Now both use getEffectiveVersion(), which returns the ldflags-injected
MilvusVersion (e.g. "master-20260228-add6e4c6d4" for dev builds) when
available, falling back to common.Version for release builds where the
git tag matches the semver.

This is consistent with the GetVersion RPC and Connect RPC which
already use getEffectiveVersion() via the MILVUS_GIT_BUILD_TAGS env var
(PR #47822). The internal session compatibility system is unaffected as
it reads common.Version directly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: yanliang567 <82361606+yanliang567@users.noreply.github.com>
This commit is contained in:
yanliang567
2026-02-28 11:48:24 +08:00
co-authored by Claude Opus 4.6
parent 0748e46bed
commit 3aedd2bc37
+2 -2
View File
@@ -56,12 +56,12 @@ func (c *run) printBanner(w io.Writer) {
fmt.Fprintln(w, " /_/ /_/___/____/___/\\____/___/ ")
fmt.Fprintln(w)
fmt.Fprintln(w, "Welcome to Milvus!")
fmt.Fprintln(w, "Version: "+common.Version.String())
fmt.Fprintln(w, "Version: "+getEffectiveVersion())
fmt.Fprintln(w, "Built: "+BuildTime)
fmt.Fprintln(w, "GitCommit: "+GitCommit)
fmt.Fprintln(w, "GoVersion: "+GoVersion)
fmt.Fprintln(w)
metrics.BuildInfo.WithLabelValues(common.Version.String(), BuildTime, GitCommit).Set(1)
metrics.BuildInfo.WithLabelValues(getEffectiveVersion(), BuildTime, GitCommit).Set(1)
}
func (c *run) printHardwareInfo(w io.Writer) {