feat(metrics): add retina_build_info Prometheus gauge#2260
feat(metrics): add retina_build_info Prometheus gauge#2260mail2sudheerobbu-oss wants to merge 4 commits into
Conversation
|
Hi @nairashu @alam-tahmid — gentle ping! This PR adds a |
|
Hi @mainred @jimassa — gentle ping on this PR. It adds a |
|
Hi @nairashu @alam-tahmid - branch just rebased onto latest upstream/main (no conflicts). This adds a standard |
d2c0d8a to
1f24181
Compare
Fixes microsoft#338 Signed-off-by: Sudheer Obbu <mail2sudheerobbu@gmail.com>
1f24181 to
961c0cd
Compare
|
@nairashu @alam-tahmid @mainred — this PR adds a |
|
Hi @rbtr, this PR was closed by reference to a comment on #2144, but it's an entirely independent contribution that I think deserves its own evaluation. It adds a standard retina_build_info Prometheus gauge (fixes #338) 29 lines across 2 files, following the exact prometheus.NewGaugeVec pattern already used in the codebase. There are no open technical concerns from any reviewer on this PR. |
Summary
Adds a standard
retina_build_infoPrometheus gauge metric following the Prometheus build_info convention.Fixes #338
Changes
internal/buildinfo/buildinfo.go: AddsRevisionandBranchstring variables (populated via-ldflagsat build time, alongside the existingVersion).pkg/metrics/metrics.go: AddsBuildInfo *prometheus.GaugeVecwith labelsversion,revision,branch,goversion, andInitBuildInfo(reg prometheus.Registerer)which registers the metric and sets it to1with current build values.Usage
Call
metrics.InitBuildInfo(prometheus.DefaultRegisterer)once at startup. The resulting metric:Testing
GOOS=linux go vet ./pkg/metrics/... ./internal/buildinfo/...passes. Unit tests can be added as a follow-up.Signed-off-by: Sudheer Obbu mail2sudheerobbu@gmail.com