Skip to content

Commit

Permalink
Set prometheus version on app start (#1089)
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-khimov authored Mar 3, 2025
2 parents 8a00747 + 9d048e2 commit 879cbd5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions api/metrics/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ func init() {
prometheus.MustRegister(versionInfo)
prometheus.MustRegister(statsMetrics)
prometheus.MustRegister(httpRequestsDuration)

// Expose current version information
versionInfo.WithLabelValues(version.Version).Set(1.0)
}

func collectNetworkMetrics(ch chan<- prometheus.Metric) {
Expand Down Expand Up @@ -59,9 +62,6 @@ func (s *stats) Describe(ch chan<- *prometheus.Desc) {
}

func (s *stats) Collect(ch chan<- prometheus.Metric) {
// Expose current version information
versionInfo.WithLabelValues(version.Version).Set(1.0)

// connect collectors
collectHTTPMetrics(ch)
collectNetworkMetrics(ch)
Expand Down

0 comments on commit 879cbd5

Please sign in to comment.