Skip to content

Commit 18685ee

Browse files
authored
Export prometheus client_golang's Go build_info metric (#8482)
We have our own version metric already, but supporting client_golang's build_info means we can be more compatible with other Golang programs we run which export this metric. We can consider deprecating and removing our own metric in the future, but we have dashboards and alerts using it, so there's no rush to do that.
1 parent bdb9cda commit 18685ee

File tree

4 files changed

+184
-0
lines changed

4 files changed

+184
-0
lines changed

cmd/shell.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"github.com/go-sql-driver/mysql"
2525
"github.com/prometheus/client_golang/prometheus"
2626
"github.com/prometheus/client_golang/prometheus/collectors"
27+
"github.com/prometheus/client_golang/prometheus/collectors/version"
2728
"github.com/prometheus/client_golang/prometheus/promhttp"
2829
"github.com/redis/go-redis/v9"
2930
"go.opentelemetry.io/otel"
@@ -271,6 +272,7 @@ func newStatsRegistry(addr string, logger blog.Logger) prometheus.Registerer {
271272
registry.MustRegister(collectors.NewProcessCollector(
272273
collectors.ProcessCollectorOpts{}))
273274
registry.MustRegister(newVersionCollector())
275+
registry.MustRegister(version.NewCollector("boulder"))
274276

275277
mux := http.NewServeMux()
276278
// Register the available pprof handlers. These are all registered on

vendor/github.com/prometheus/client_golang/prometheus/collectors/version/version.go

Lines changed: 47 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/prometheus/common/version/info.go

Lines changed: 133 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/modules.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ github.com/prometheus/client_golang/internal/github.com/golang/gddo/httputil
244244
github.com/prometheus/client_golang/internal/github.com/golang/gddo/httputil/header
245245
github.com/prometheus/client_golang/prometheus
246246
github.com/prometheus/client_golang/prometheus/collectors
247+
github.com/prometheus/client_golang/prometheus/collectors/version
247248
github.com/prometheus/client_golang/prometheus/internal
248249
github.com/prometheus/client_golang/prometheus/promauto
249250
github.com/prometheus/client_golang/prometheus/promhttp
@@ -255,6 +256,7 @@ github.com/prometheus/client_model/go
255256
## explicit; go 1.21
256257
github.com/prometheus/common/expfmt
257258
github.com/prometheus/common/model
259+
github.com/prometheus/common/version
258260
# github.com/prometheus/procfs v0.15.1
259261
## explicit; go 1.20
260262
github.com/prometheus/procfs

0 commit comments

Comments
 (0)