Skip to content

Commit

Permalink
changed metric to gauge (#1660)
Browse files Browse the repository at this point in the history
  • Loading branch information
debebantur committed Mar 15, 2024
1 parent 8052d21 commit 4689e3a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions internal/statistics/metrics.go
Expand Up @@ -18,7 +18,7 @@ type metrics struct {
UploadedFilesTotal prometheus.Counter
UploadedFilesFailedTotal prometheus.Counter

S3Codes prometheus.CounterVec
S3Codes prometheus.GaugeVec
}

var (
Expand All @@ -37,8 +37,8 @@ var (
Help: "Number of file upload failures.",
},
),
S3Codes: *prometheus.NewCounterVec(
prometheus.CounterOpts{
S3Codes: *prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: WalgMetricsPrefix + "s3_response_",
Help: "S3 response codes.",
},
Expand Down Expand Up @@ -131,6 +131,7 @@ func writeMetricFamilyToStatsd(client statsd.Statter, in *dto.MetricFamily, extr
if metric.Gauge == nil {
return fmt.Errorf("expected gauge in metric %s %s", name, metric)
}
tracelog.DebugLogger.Printf("writing metric: %s", metric.String())
err := client.Gauge(name, int64(metric.Gauge.GetValue()), 1.0, tags...)
if err != nil {
return err
Expand Down

0 comments on commit 4689e3a

Please sign in to comment.