diff --git a/CHANGELOG.md b/CHANGELOG.md index 79650ca6..3a43c278 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re ### Fixed - [#33](https://github.com/thanos-io/objstore/pull/33) Tracing: Add `ContextWithTracer()` to inject the tracer into the context. - [#34](https://github.com/thanos-io/objstore/pull/34) Fix ignored options when creating shared credential Azure client. -- [#62](https://github.com/thanos-io/objstore/pull/62) S3: Fix ignored context cancellation in `Iter` method. +- [#62](https://github.com/thanos-io/objstore/pull/62) S3: Fix ignored context cancellation in `Iter` method. ### Added - [#15](https://github.com/thanos-io/objstore/pull/15) Add Oracle Cloud Infrastructure Object Storage Bucket support. @@ -26,7 +26,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re - [#59](https://github.com/thanos-io/objstore/pull/59) Adding method `IsCustomerManagedKeyError` on the bucket interface. - [#61](https://github.com/thanos-io/objstore/pull/61) Add OpenTelemetry TracingBucket. > This also changes the behaviour of `client.NewBucket`. Now it returns, uninstrumented and untraced bucket. - You can combine `client.InstrumentedBucket` and `tracing/{opentelemetry,opentracing}.TracedBucket` to have old behavior. + You can combine `objstore.WrapWithMetrics` and `tracing/{opentelemetry,opentracing}.WrapWithTraces` to have old behavior. ### Changed - [#38](https://github.com/thanos-io/objstore/pull/38) *: Upgrade minio-go version to `v7.0.45`. diff --git a/client/factory.go b/client/factory.go index f7dedebd..9e1adec9 100644 --- a/client/factory.go +++ b/client/factory.go @@ -23,7 +23,6 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" "github.com/pkg/errors" - "github.com/prometheus/client_golang/prometheus" "gopkg.in/yaml.v2" ) @@ -93,8 +92,3 @@ func NewBucket(logger log.Logger, confContentYaml []byte, component string) (obj return objstore.NewPrefixedBucket(bucket, bucketConf.Prefix), nil } - -// InstrumentedBucket wraps the given bucket with metrics. -func InstrumentedBucket(bkt objstore.Bucket, reg prometheus.Registerer) objstore.InstrumentedBucket { - return objstore.WrapWithMetrics(bkt, reg, bkt.Name()) -} diff --git a/client/factory_test.go b/client/factory_test.go index 46a3833c..ae1e980e 100644 --- a/client/factory_test.go +++ b/client/factory_test.go @@ -9,7 +9,6 @@ import ( "io/ioutil" "github.com/go-kit/log" - "github.com/prometheus/client_golang/prometheus" "go.opentelemetry.io/otel/trace" "github.com/thanos-io/objstore/tracing/opentelemetry" @@ -39,32 +38,6 @@ func ExampleBucket() { // false } -func ExampleInstrumentedBucket() { - // Read the configuration file. - confContentYaml, err := ioutil.ReadFile("testconf/filesystem.conf.yml") - if err != nil { - panic(err) - } - - // Create a new bucket. - bucket, err := NewBucket(log.NewNopLogger(), confContentYaml, "example") - if err != nil { - panic(err) - } - - // Wrap it with instrumentation. - bucket = InstrumentedBucket(bucket, prometheus.NewRegistry()) - - // Test it. - exists, err := bucket.Exists(context.Background(), "example") - if err != nil { - panic(err) - } - fmt.Println(exists) - // Output: - // false -} - func ExampleTracingBucketUsingOpenTracing() { //nolint:govet // Read the configuration file. confContentYaml, err := ioutil.ReadFile("testconf/filesystem.conf.yml") @@ -79,7 +52,7 @@ func ExampleTracingBucketUsingOpenTracing() { //nolint:govet } // Wrap it with tracing. - bucket = opentracing.TracedBucket(bucket) + bucket = opentracing.WrapWithTraces(bucket) // Test it. exists, err := bucket.Exists(context.Background(), "example") @@ -105,7 +78,7 @@ func ExampleTracingBucketUsingOpenTelemetry() { //nolint:govet } // Wrap it with tracing. - bucket = opentelemetry.TracedBucket(bucket, trace.NewNoopTracerProvider().Tracer("bucket")) + bucket = opentelemetry.WrapWithTraces(bucket, trace.NewNoopTracerProvider().Tracer("bucket")) // Test it. exists, err := bucket.Exists(context.Background(), "example") diff --git a/tracing/opentelemetry/opentelemetry.go b/tracing/opentelemetry/opentelemetry.go index 057641be..0e7a279a 100644 --- a/tracing/opentelemetry/opentelemetry.go +++ b/tracing/opentelemetry/opentelemetry.go @@ -19,7 +19,7 @@ type TracingBucket struct { bkt objstore.Bucket } -func TracedBucket(bkt objstore.Bucket, tracer trace.Tracer) objstore.InstrumentedBucket { +func WrapWithTraces(bkt objstore.Bucket, tracer trace.Tracer) objstore.InstrumentedBucket { return TracingBucket{tracer: tracer, bkt: bkt} } diff --git a/tracing/opentracing/opentracing.go b/tracing/opentracing/opentracing.go index 508205d4..8174afb1 100644 --- a/tracing/opentracing/opentracing.go +++ b/tracing/opentracing/opentracing.go @@ -40,7 +40,7 @@ type TracingBucket struct { bkt objstore.Bucket } -func TracedBucket(bkt objstore.Bucket) objstore.InstrumentedBucket { +func WrapWithTraces(bkt objstore.Bucket) objstore.InstrumentedBucket { return TracingBucket{bkt: bkt} }