From 31c0873d5266a6c58fe8fb5d6de01b66dcd50f5f Mon Sep 17 00:00:00 2001 From: Siavash Safi Date: Mon, 28 Oct 2024 15:45:11 +0100 Subject: [PATCH 1/2] fix objstore_bucket_operation_duration_seconds metrics fix histogram metrics for `get` and `getrange` operations. Signed-off-by: Siavash Safi --- objstore.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/objstore.go b/objstore.go index 5bce3ef6..62f1c655 100644 --- a/objstore.go +++ b/objstore.go @@ -573,7 +573,7 @@ func (b *metricBucket) Get(ctx context.Context, name string) (io.ReadCloser, err if !b.metrics.isOpFailureExpected(err) && ctx.Err() != context.Canceled { b.metrics.opsFailures.WithLabelValues(op).Inc() } - b.metrics.opsDuration.WithLabelValues(op).Observe(float64(time.Since(start))) + b.metrics.opsDuration.WithLabelValues(op).Observe(time.Since(start).Seconds()) return nil, err } return newTimingReader( @@ -600,7 +600,7 @@ func (b *metricBucket) GetRange(ctx context.Context, name string, off, length in if !b.metrics.isOpFailureExpected(err) && ctx.Err() != context.Canceled { b.metrics.opsFailures.WithLabelValues(op).Inc() } - b.metrics.opsDuration.WithLabelValues(op).Observe(float64(time.Since(start))) + b.metrics.opsDuration.WithLabelValues(op).Observe(time.Since(start).Seconds()) return nil, err } return newTimingReader( From cf96e342ed0d5977b1269c08d8c34ea9bd5ff442 Mon Sep 17 00:00:00 2001 From: Siavash Safi Date: Mon, 28 Oct 2024 15:59:44 +0100 Subject: [PATCH 2/2] add changelog Signed-off-by: Siavash Safi --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75cbd834..d2b1aaab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re - [#145](https://github.com/thanos-io/objstore/pull/145) Include content length in the response of Get and GetRange. ### Fixed +- [#153](https://github.com/thanos-io/objstore/pull/153) Metrics: Fix `objstore_bucket_operation_duration_seconds_*` for `get` and `get_range` operations. - [#117](https://github.com/thanos-io/objstore/pull/117) Metrics: Fix `objstore_bucket_operation_failures_total` incorrectly incremented if context is cancelled while reading object contents. - [#115](https://github.com/thanos-io/objstore/pull/115) GCS: Fix creation of bucket with GRPC connections. Also update storage client to `v1.40.0`. - [#102](https://github.com/thanos-io/objstore/pull/102) Azure: bump azblob sdk to get concurrency fixes.