Skip to content

Commit

Permalink
chore: use histogram
Browse files Browse the repository at this point in the history
  • Loading branch information
acha-bill committed Oct 23, 2023
1 parent c67ea17 commit 23f5976
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/check/longavailability/longavailability.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/check/longavailability/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
type metrics struct {
DownloadErrors prometheus.Counter
DownloadAttempts prometheus.Counter
DownloadDuration prometheus.Gauge
DownloadDuration prometheus.Histogram
DownloadSize prometheus.Gauge
}

Expand All @@ -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",
Expand Down

0 comments on commit 23f5976

Please sign in to comment.