Skip to content
Snippets Groups Projects
Commit 00d30a69 authored by ale's avatar ale
Browse files

Add probe_duration_seconds to metrics

Fixes issue #2.
parent 2df9c59c
No related branches found
No related tags found
No related merge requests found
......@@ -18,10 +18,18 @@ var (
},
[]string{"probe", "probeset"},
)
probeDuration = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "probe_duration_seconds",
Help: "Duration of the last probe execution.",
},
[]string{"probe", "probeset"},
)
)
func init() {
prometheus.MustRegister(probeSuccess, probeLastRun)
prometheus.MustRegister(probeSuccess, probeLastRun, probeDuration)
}
type promResultStore struct {
......@@ -43,4 +51,5 @@ func (p *promResultStore) Push(result *Result) {
probeset := result.Spec.Labels["probeset"]
probeSuccess.WithLabelValues(result.Spec.Name, probeset).Set(success)
probeLastRun.WithLabelValues(result.Spec.Name, probeset).Set(float64(result.Start.Unix()))
probeDuration.WithLabelValues(result.Spec.Name, probeset).Set(result.Duration.Seconds())
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment