This repository was archived by the owner on Mar 19, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -218,6 +218,7 @@ func (a *app) getResolverConfig() ([]string, *resolver.Config) {
218218
219219func (a * app ) initMetrics () {
220220 gateMetricsProvider := metrics .NewGateMetrics (a .pool )
221+ gateMetricsProvider .SetGWVersion (Version )
221222 a .metrics = newGateMetrics (a .log , gateMetricsProvider , a .cfg .GetBool (cfgPrometheusEnabled ))
222223}
223224
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ type GateMetrics struct {
3838
3939type stateMetrics struct {
4040 healthCheck prometheus.Gauge
41+ gwVersion * prometheus.GaugeVec
4142}
4243
4344type poolMetricsCollector struct {
@@ -76,6 +77,14 @@ func newStateMetrics() *stateMetrics {
7677 Name : "health" ,
7778 Help : "Current HTTP gateway state" ,
7879 }),
80+ gwVersion : prometheus .NewGaugeVec (
81+ prometheus.GaugeOpts {
82+ Help : "Gateway version" ,
83+ Name : "version" ,
84+ Namespace : namespace ,
85+ },
86+ []string {"version" },
87+ ),
7988 }
8089}
8190
@@ -234,3 +243,7 @@ func NewPrometheusService(log *zap.Logger, cfg Config) *Service {
234243 log : log .With (zap .String ("service" , "Prometheus" )),
235244 }
236245}
246+
247+ func (g * GateMetrics ) SetGWVersion (ver string ) {
248+ g .gwVersion .WithLabelValues (ver ).Add (1 )
249+ }
You can’t perform that action at this time.
0 commit comments