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)
| 660 | // describing the running server version. This follows the common |
| 661 | // pattern used by Prometheus itself and many Go services. |
| 662 | func 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, |