diff --git a/objstore.go b/objstore.go index 2a0fe4dc..783c16f9 100644 --- a/objstore.go +++ b/objstore.go @@ -455,6 +455,11 @@ func WrapWithMetrics(b Bucket, reg prometheus.Registerer, name string) *metricBu bkt.ops.WithLabelValues(op) bkt.opsFailures.WithLabelValues(op) bkt.opsDuration.WithLabelValues(op) + } + for _, op := range []string{ + OpGet, + OpGetRange, + } { bkt.opsFetchedBytes.WithLabelValues(op) } // fetched bytes only relevant for get and getrange diff --git a/objstore_test.go b/objstore_test.go index ab5c5e5b..e27bfd80 100644 --- a/objstore_test.go +++ b/objstore_test.go @@ -112,13 +112,8 @@ func TestDownloadUploadDirConcurrency(t *testing.T) { testutil.Ok(t, promtest.GatherAndCompare(r, strings.NewReader(` # HELP objstore_bucket_operation_fetched_bytes_total Total number of bytes fetched from bucket, per operation. # TYPE objstore_bucket_operation_fetched_bytes_total counter - objstore_bucket_operation_fetched_bytes_total{bucket="",operation="attributes"} 0 - objstore_bucket_operation_fetched_bytes_total{bucket="",operation="delete"} 0 - objstore_bucket_operation_fetched_bytes_total{bucket="",operation="exists"} 0 objstore_bucket_operation_fetched_bytes_total{bucket="",operation="get"} 1.048578e+06 objstore_bucket_operation_fetched_bytes_total{bucket="",operation="get_range"} 0 - objstore_bucket_operation_fetched_bytes_total{bucket="",operation="iter"} 0 - objstore_bucket_operation_fetched_bytes_total{bucket="",operation="upload"} 0 `), `objstore_bucket_operation_fetched_bytes_total`)) testutil.Ok(t, promtest.GatherAndCompare(r, strings.NewReader(`