Skip to content

Commit a3cb03a

Browse files
committed
TRT-1989: adds loadMetricGauge minutes metric
1 parent 37aa9d3 commit a3cb03a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pkg/dataloader/loaderwithmetrics/loaderwithmetrics.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ import (
1515
"github.com/openshift/sippy/pkg/dataloader"
1616
)
1717

18+
// want a single total load time
19+
var loadMetricGauge = promauto.NewGauge(prometheus.GaugeOpts{
20+
Name: "sippy_data_load_minutes",
21+
Help: "Minutes to load data into the DB",
22+
})
23+
1824
var loadMetric = promauto.NewHistogramVec(prometheus.HistogramOpts{
1925
Name: "sippy_data_load_millis",
2026
Help: "Milliseconds to load data into the DB",
@@ -41,6 +47,7 @@ func New(wrappedLoaders []dataloader.DataLoader) *LoaderWithMetrics {
4147
loader.promPusher = push.New(pushgateway, "sippy-prow-job-loader")
4248
loader.promPusher.Collector(errorMetric)
4349
loader.promPusher.Collector(loadMetric)
50+
loader.promPusher.Collector(loadMetricGauge)
4451
}
4552

4653
return loader
@@ -89,6 +96,7 @@ func (l *LoaderWithMetrics) Load() {
8996
overallDuration := time.Since(overallStart)
9097
log.Infof("%d loaders finished in %+v...", len(l.loaders), overallDuration)
9198
loadMetric.WithLabelValues("total").Observe(float64(overallDuration.Milliseconds()))
99+
loadMetricGauge.Set(float64(overallDuration.Minutes()))
92100

93101
if l.promPusher != nil {
94102
log.Info("pushing metrics to prometheus gateway")

0 commit comments

Comments
 (0)