Skip to content

feat(metrics): add retina_build_info Prometheus gauge#2260

Closed
mail2sudheerobbu-oss wants to merge 4 commits into
microsoft:mainfrom
mail2sudheerobbu-oss:feat/retina-build-info-metric
Closed

feat(metrics): add retina_build_info Prometheus gauge#2260
mail2sudheerobbu-oss wants to merge 4 commits into
microsoft:mainfrom
mail2sudheerobbu-oss:feat/retina-build-info-metric

Conversation

@mail2sudheerobbu-oss

Copy link
Copy Markdown

Summary

Adds a standard retina_build_info Prometheus gauge metric following the Prometheus build_info convention.

Fixes #338

Changes

  • internal/buildinfo/buildinfo.go: Adds Revision and Branch string variables (populated via -ldflags at build time, alongside the existing Version).
  • pkg/metrics/metrics.go: Adds BuildInfo *prometheus.GaugeVec with labels version, revision, branch, goversion, and InitBuildInfo(reg prometheus.Registerer) which registers the metric and sets it to 1 with current build values.

Usage

Call metrics.InitBuildInfo(prometheus.DefaultRegisterer) once at startup. The resulting metric:

retina_build_info{version="v0.0.1",revision="abc1234",branch="main",goversion="go1.21.0"} 1

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

@mail2sudheerobbu-oss

Copy link
Copy Markdown
Author

Hi @nairashu @alam-tahmid — gentle ping! This PR adds a retina_build_info Prometheus gauge metric exposing version, git commit, and build date (fixes #338). The implementation follows the standard prometheus.NewGaugeVec pattern already used in the codebase. No conflicts. Would appreciate a review when you get a chance. Thanks!

@mail2sudheerobbu-oss

Copy link
Copy Markdown
Author

Hi @mainred @jimassa — gentle ping on this PR. It adds a retina_build_info Prometheus gauge that exposes build metadata (version, commit, OS/arch) as labels, following the standard build_info pattern used across the CNCF ecosystem. Branch is synced with main and no conflicts. Would appreciate a review when you get a chance! 🙏

@mail2sudheerobbu-oss

Copy link
Copy Markdown
Author

Hi @nairashu @alam-tahmid - branch just rebased onto latest upstream/main (no conflicts). This adds a standard retina_build_info Prometheus gauge with version, commit, OS/arch labels, following the build_info pattern used across the CNCF ecosystem. No reviews yet - would appreciate a look when you get a chance!

@mail2sudheerobbu-oss mail2sudheerobbu-oss force-pushed the feat/retina-build-info-metric branch 2 times, most recently from d2c0d8a to 1f24181 Compare May 9, 2026 00:26
Fixes microsoft#338

Signed-off-by: Sudheer Obbu <mail2sudheerobbu@gmail.com>
@mail2sudheerobbu-oss mail2sudheerobbu-oss force-pushed the feat/retina-build-info-metric branch from 1f24181 to 961c0cd Compare May 9, 2026 00:54
@mail2sudheerobbu-oss

Copy link
Copy Markdown
Author

@nairashu @alam-tahmid @mainred — this PR adds a retina_build_info Prometheus gauge (closes #338). It's a small, focused change (+29 lines across 2 files). Could a maintainer approve the CI workflows to run and review when you have a moment?

@rbtr

rbtr commented May 29, 2026

Copy link
Copy Markdown
Collaborator

#2144 (comment)

@rbtr rbtr closed this May 29, 2026
@mail2sudheerobbu-oss

Copy link
Copy Markdown
Author

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.
I understand there were concerns about comment volume on #2144. I'll keep this thread clean. Would you or another maintainer be willing to give the code itself a look? you shouldn't generalize and wipe all my contributions..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prometheus metrics build info: retina_build_info

2 participants