Skip to content

Commit 8cbd222

Browse files
committed
TUN-5703: Add prometheus metric for current configuration version
1 parent a50c0ca commit 8cbd222

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

orchestration/metrics.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package orchestration
2+
3+
import (
4+
"github.com/prometheus/client_golang/prometheus"
5+
)
6+
7+
const (
8+
MetricsNamespace = "cloudflared"
9+
MetricsSubsystem = "orchestration"
10+
)
11+
12+
var (
13+
configVersion = prometheus.NewGauge(
14+
prometheus.GaugeOpts{
15+
Namespace: MetricsNamespace,
16+
Subsystem: MetricsSubsystem,
17+
Name: "config_version",
18+
Help: "Configuration Version",
19+
},
20+
)
21+
)
22+
23+
func init() {
24+
prometheus.MustRegister(configVersion)
25+
}

orchestration/orchestrator.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ func (o *Orchestrator) UpdateConfig(version int32, config []byte) *tunnelpogs.Up
9595
Int32("version", version).
9696
Str("config", string(config)).
9797
Msg("Updated to new configuration")
98+
configVersion.Set(float64(version))
9899
return &tunnelpogs.UpdateConfigurationResponse{
99100
LastAppliedVersion: o.currentVersion,
100101
}

0 commit comments

Comments
 (0)