MCPcopy Index your code
hub / github.com/coder/coder / BuildInfo

Function BuildInfo

coderd/prometheusmetrics/prometheusmetrics.go:662–675  ·  view source on GitHub ↗

BuildInfo registers a gauge which is always set to 1, with labels describing the running server version. This follows the common pattern used by Prometheus itself and many Go services.

(registerer prometheus.Registerer, version, revision string)

Source from the content-addressed store, hash-verified

660// describing the running server version. This follows the common
661// pattern used by Prometheus itself and many Go services.
662func BuildInfo(registerer prometheus.Registerer, version, revision string) error {
663 gauge := prometheus.NewGaugeVec(prometheus.GaugeOpts{
664 Namespace: "coderd",
665 Name: "build_info",
666 Help: "Describes the current build/version of the Coder server. Value is always 1.",
667 }, []string{"version", "revision"})
668 if err := registerer.Register(gauge); err != nil {
669 return err
670 }
671
672 gauge.WithLabelValues(version, revision).Set(1)
673
674 return nil
675}
676
677// filterAcceptableAgentLabels handles a slightly messy situation whereby `prometheus-aggregate-agent-stats-by` can control on
678// which labels agent stats are aggregated, but for these specific metrics in this file there is no `template` label value,

Callers 2

TestBuildInfoFunction · 0.92
ServerMethod · 0.92

Calls 3

WithLabelValuesMethod · 0.80
SetMethod · 0.65
RegisterMethod · 0.45

Tested by 1

TestBuildInfoFunction · 0.74