feat: add coder_build_info metric (#24365)

_Disclaimer: produced by Claude Opus 4.6_

Adds a `coder_build_info` metric which allows operators to see which
versions of Coder are currently running.

---------

Signed-off-by: Danny Kopping <danny@coder.com>
This commit is contained in:
Danny Kopping
2026-04-15 12:48:38 +00:00
committed by GitHub
parent d0c9571f62
commit 48b90f8cc8
6 changed files with 58 additions and 4 deletions
+5
View File
@@ -1013,6 +1013,11 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
if err = prometheusmetrics.Experiments(options.PrometheusRegistry, active); err != nil {
return xerrors.Errorf("register experiments metric: %w", err)
}
revision, _ := buildinfo.Revision()
if err = prometheusmetrics.BuildInfo(options.PrometheusRegistry, buildinfo.Version(), revision); err != nil {
return xerrors.Errorf("register build info metric: %w", err)
}
}
// This is helpful for tests, but can be silently ignored.