TUN-5703: Add prometheus metric for current configuration version
This commit is contained in:
parent
a50c0ca9ad
commit
8cbd222e10
|
@ -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)
|
||||||
|
}
|
|
@ -95,6 +95,7 @@ func (o *Orchestrator) UpdateConfig(version int32, config []byte) *tunnelpogs.Up
|
||||||
Int32("version", version).
|
Int32("version", version).
|
||||||
Str("config", string(config)).
|
Str("config", string(config)).
|
||||||
Msg("Updated to new configuration")
|
Msg("Updated to new configuration")
|
||||||
|
configVersion.Set(float64(version))
|
||||||
return &tunnelpogs.UpdateConfigurationResponse{
|
return &tunnelpogs.UpdateConfigurationResponse{
|
||||||
LastAppliedVersion: o.currentVersion,
|
LastAppliedVersion: o.currentVersion,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue