v1.1.3: surface daemon version + commit on maglev_info

Extend the existing maglev_info gauge with two more labels:
- version (build version, from -ldflags)
- commit (git short hash)

Mirrors nginx_ipng_stats-plugin's nginx_ipng_info pattern: a
label-only gauge value=1 carrying build metadata for Prometheus
to query and Grafana dashboards to render. Useful for spotting
version drift across the fleet with a single query, and for
populating the "Version" column of the Maglev Nodes table on
the global overview.

Existing label source_tag is preserved.

Plumbing: NewCollector / Register signatures gain version and
commit string parameters; main.go reads them from cmd.Version()
and cmd.Commit() (already imported as 'buildinfo').
This commit is contained in:
2026-05-01 23:20:03 +02:00
parent dc7599f3ee
commit d2ee6d009e
3 changed files with 15 additions and 9 deletions
+1 -1
View File
@@ -150,7 +150,7 @@ func run() error {
if vppClient != nil {
vppSrc = vppClient
}
metrics.Register(reg, chkr, vppSrc, cfg.SourceTag)
metrics.Register(reg, chkr, vppSrc, cfg.SourceTag, buildinfo.Version(), buildinfo.Commit())
reg.MustRegister(grpcMetrics)
mux := http.NewServeMux()