From 23f59768969a2cf2ddfacec3f599db8865662839 Mon Sep 17 00:00:00 2001 From: Acha Bill Date: Mon, 23 Oct 2023 22:46:11 +0100 Subject: [PATCH] chore: use histogram --- pkg/check/longavailability/longavailability.go | 2 +- pkg/check/longavailability/metrics.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/check/longavailability/longavailability.go b/pkg/check/longavailability/longavailability.go index 5789c508e..b252e598e 100644 --- a/pkg/check/longavailability/longavailability.go +++ b/pkg/check/longavailability/longavailability.go @@ -84,7 +84,7 @@ func (c *Check) Run(ctx context.Context, cluster orchestration.Cluster, o interf c.logger.Infof("download size %d", size) c.metrics.DownloadSize.Set(float64(size)) dur := time.Since(start) - c.metrics.DownloadDuration.Set(dur.Seconds()) + c.metrics.DownloadDuration.Observe(dur.Seconds()) c.logger.Infof("node %s: downloaded %s successfully in %v", node.Name(), addr, dur) break } diff --git a/pkg/check/longavailability/metrics.go b/pkg/check/longavailability/metrics.go index 32e1e29a5..cae857834 100644 --- a/pkg/check/longavailability/metrics.go +++ b/pkg/check/longavailability/metrics.go @@ -8,7 +8,7 @@ import ( type metrics struct { DownloadErrors prometheus.Counter DownloadAttempts prometheus.Counter - DownloadDuration prometheus.Gauge + DownloadDuration prometheus.Histogram DownloadSize prometheus.Gauge } @@ -28,8 +28,8 @@ func newMetrics(subsystem string) metrics { Name: "download_errors_count", Help: "The total number of errors encountered before successful download.", }), - DownloadDuration: prometheus.NewGauge( - prometheus.GaugeOpts{ + DownloadDuration: prometheus.NewHistogram( + prometheus.HistogramOpts{ Namespace: m.Namespace, Subsystem: subsystem, Name: "data_download_duration",