diff --git a/orchestration/metrics.go b/orchestration/metrics.go new file mode 100644 index 00000000..1fa5e8a5 --- /dev/null +++ b/orchestration/metrics.go @@ -0,0 +1,25 @@ +package orchestration + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +const ( + MetricsNamespace = "cloudflared" + MetricsSubsystem = "orchestration" +) + +var ( + configVersion = prometheus.NewGauge( + prometheus.GaugeOpts{ + Namespace: MetricsNamespace, + Subsystem: MetricsSubsystem, + Name: "config_version", + Help: "Configuration Version", + }, + ) +) + +func init() { + prometheus.MustRegister(configVersion) +} diff --git a/orchestration/orchestrator.go b/orchestration/orchestrator.go index d072e966..59d8db57 100644 --- a/orchestration/orchestrator.go +++ b/orchestration/orchestrator.go @@ -95,6 +95,7 @@ func (o *Orchestrator) UpdateConfig(version int32, config []byte) *tunnelpogs.Up Int32("version", version). Str("config", string(config)). Msg("Updated to new configuration") + configVersion.Set(float64(version)) return &tunnelpogs.UpdateConfigurationResponse{ LastAppliedVersion: o.currentVersion, }