Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OTel tracing bucket #61

Merged
merged 4 commits into from
Jul 13, 2023
Merged

Add OTel tracing bucket #61

merged 4 commits into from
Jul 13, 2023

Conversation

kakkoyun
Copy link
Member

@kakkoyun kakkoyun commented Jul 6, 2023

  • Refactor client.NewBucket. This changes the behaviour of client.NewBucket. Now it returns, uninstrumented and untraced bucket.
  • Add OpenTelemetry TracingBucket.

Now you can combine objstore.WrapWithMetrics and tracing/{opentelemetry,opentracing}.WrapWithTraces to have old behavior.

Signed-off-by: Kemal Akkoyun kakkoyun@gmail.com

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

  • Add OTel Tracing bucket
  • Introduce tracing package
  • Refactor client.NewBucket
  • Introduce client.NewInstrumentedBucket
  • Add examples

Verification

Copy link
Member

@brancz brancz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy with this. Are you going to take care of fixing Thanos to make sure it doesn't loose instrumentation?

client/factory.go Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@kakkoyun
Copy link
Member Author

kakkoyun commented Jul 6, 2023

I'm happy with this. Are you going to take care of fixing Thanos to make sure it doesn't lose instrumentation?

I'll make sure to do that. Maybe we can use opentracing tracing for the instrumented bucket? WDYT?

@kakkoyun kakkoyun force-pushed the add_otel_tracing_bucket branch 2 times, most recently from 860ea66 to e16e78f Compare July 6, 2023 11:24
@brancz
Copy link
Member

brancz commented Jul 6, 2023

I think just replacing the spots where Thanos just called NewBucket, after this merges replace that with NewTracingBucket(NewInstrumentedBucket(NewBucket(...))). That would be sufficient.

@kakkoyun
Copy link
Member Author

kakkoyun commented Jul 6, 2023

I think just replacing the spots where Thanos just called NewBucket, after this merges replace that with NewTracingBucket(NewInstrumentedBucket(NewBucket(...))). That would be sufficient.

thanos-io/thanos#6507

Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Some comments, otherwise LGTM 👍🏽

tracing/tracing.go Outdated Show resolved Hide resolved
client/factory.go Show resolved Hide resolved
return objstore.NewPrefixedBucket(bucket, bucketConf.Prefix), nil
}

// NewInstrumentedBucket initializes and returns new object storage clients.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not true - it only wraps with metrics. Should we rather remove NewInstrumentedBucket and keep objstore.BucketWithMetrics?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Fine by me, less is more :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not addressed.


// NewInstrumentedBucket initializes and returns new object storage clients.
func NewInstrumentedBucket(reg prometheus.Registerer, bkt objstore.Bucket) objstore.InstrumentedBucket {
return objstore.BucketWithMetrics(bkt.Name(), bkt, reg)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed this:

Suggested change
return objstore.BucketWithMetrics(bkt.Name(), bkt, reg)
objstore.InstrumentedBucket(bkt.Name(), bkt, reg)

so we have "InstrumentedBucket", "otel.TracingBucket", "opentracing.TracingBucket"? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can see it in action thanos-io/thanos#6507

Do you have any other suggestion?

Copy link
Member

@bwplotka bwplotka Jul 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean?

Anyway, BucketWithMetrics is now WrapWithMetrics not InstrumentedBucket as I suggested. You changed tracing one with TracedBucket. It's improved, but the problem is still that it's a little bit inconsistent with TracedBucket naming. Either let's call this one InstrumentedBucket or if you want to keep WrapWithMetrics, we could changed TracedBucket to WrapWithTracing? Small nit, just let be clear with what suggestion you agree and which not (:

client/testconf/fake-gcs.conf.yml Show resolved Hide resolved
tracing/opentelemetry/opentelemetry.go Outdated Show resolved Hide resolved
Refactor client.NewBucket

Add client.NewInstrumentedBucket

Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
Copy link
Member

@brancz brancz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

client/factory.go Outdated Show resolved Hide resolved
@kakkoyun
Copy link
Member Author

Ping @bwplotka, is it ok to merge now?

Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Still some unresolved comments, otherwise good to go!

client/factory.go Outdated Show resolved Hide resolved
return objstore.NewPrefixedBucket(bucket, bucketConf.Prefix), nil
}

// NewInstrumentedBucket initializes and returns new object storage clients.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not addressed.


// NewInstrumentedBucket initializes and returns new object storage clients.
func NewInstrumentedBucket(reg prometheus.Registerer, bkt objstore.Bucket) objstore.InstrumentedBucket {
return objstore.BucketWithMetrics(bkt.Name(), bkt, reg)
Copy link
Member

@bwplotka bwplotka Jul 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean?

Anyway, BucketWithMetrics is now WrapWithMetrics not InstrumentedBucket as I suggested. You changed tracing one with TracedBucket. It's improved, but the problem is still that it's a little bit inconsistent with TracedBucket naming. Either let's call this one InstrumentedBucket or if you want to keep WrapWithMetrics, we could changed TracedBucket to WrapWithTracing? Small nit, just let be clear with what suggestion you agree and which not (:

client/testconf/fake-gcs.conf.yml Show resolved Hide resolved
// Copyright (c) The Thanos Authors.
// Licensed under the Apache License 2.0.

package opentelemetry
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be simplified to otel if we want:

Suggested change
package opentelemetry
package otel

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep naming consistent with already existing parts (opentracing and opentelemetry).

Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
@kakkoyun kakkoyun requested review from bwplotka and brancz July 12, 2023 15:45
@bwplotka bwplotka merged commit eb01c83 into main Jul 13, 2023
7 checks passed
@kakkoyun kakkoyun deleted the add_otel_tracing_bucket branch July 13, 2023 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants