feat: label build identity in metrics

This commit is contained in:
2026-09-20 18:32:05 +08:00
parent 552fd22704
commit 6788d89275
4 changed files with 12 additions and 4 deletions

View File

@@ -6,6 +6,8 @@ import (
"errors"
"runtime"
"time"
"git.yuntuo.hk/k2safe/orbit/internal/buildinfo"
)
// initializeProcess is called once by the registry constructor.
@@ -14,7 +16,8 @@ func (r *Registry) initializeProcess() {
return
}
r.SetGauge("orbit_process_start_time_seconds", float64(r.started.Unix()), nil)
r.SetGauge("orbit_build_info", 1, Labels{"go_version": runtime.Version()})
build := buildinfo.Current()
r.SetGauge("orbit_build_info", 1, Labels{"go_version": build.GoVersion, "version": build.Version, "revision": build.Revision})
r.RecordProcess()
for _, component := range components {
labels := Labels{"component": component}