diff --git a/dist/grafana/grafana-prometheus-zrepl.json b/dist/grafana/grafana-prometheus-zrepl.json index 32a7895..6e00b90 100644 --- a/dist/grafana/grafana-prometheus-zrepl.json +++ b/dist/grafana/grafana-prometheus-zrepl.json @@ -249,7 +249,7 @@ "stack": true, "steppedLine": false, "targets": [{ - "expr": "zrepl_version_daemon{job='$prom_job_name'}", + "expr": "sgn(zrepl_start_time{job='$prom_job_name'})", "format": "time_series", "interval": "", "intervalFactor": 1, diff --git a/docs/changelog.rst b/docs/changelog.rst index 001cfb3..c2f8f88 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -16,6 +16,17 @@ Changelog The changelog summarizes bugfixes that are deemed relevant for users and package maintainers. Developers should consult the git commit log or GitHub issue tracker. +0.6 (Unreleased) +---------------- + +* `Feature Wishlist on GitHub `_ + +* |break| |feature| convert Prometheus metric ``zrepl_version_daemon`` to ``zrepl_start_time`` metric + + * The metric still reports the zrepl version in a label. + But the metric *value* is now the Unix timestamp at the time the daemon was started. + The Grafana dashboard in :repomasterlink:`dist/grafana` has been updated. + 0.5 --- diff --git a/version/version.go b/version/version.go index 1db908a..6830a13 100644 --- a/version/version.go +++ b/version/version.go @@ -34,20 +34,19 @@ func (i *ZreplVersionInformation) String() string { i.Version, i.RuntimeGo, i.RuntimeGOOS, i.RuntimeGOARCH, i.RUNTIMECompiler) } -var prometheusMetric = prometheus.NewUntypedFunc( - prometheus.UntypedOpts{ +var prometheusMetric = prometheus.NewGauge( + prometheus.GaugeOpts{ Namespace: "zrepl", - Subsystem: "version", - Name: "daemon", - Help: "zrepl daemon version", + Name: "start_time", + Help: "zrepl daemon start time and version", ConstLabels: map[string]string{ "raw": zreplVersion, "version_info": NewZreplVersionInformation().String(), }, }, - func() float64 { return 1 }, ) func PrometheusRegister(r prometheus.Registerer) { r.MustRegister(prometheusMetric) + prometheusMetric.SetToCurrentTime() }