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

Do not prefix Thanos objstore client metrics and fix instrumentation in querier #2568

Merged

Conversation

pracucci
Copy link
Contributor

@pracucci pracucci commented May 7, 2020

What this PR does:
Currently Thanos objstore metrics are prefixed by cortex_<service>_. This leads to two issues:

  1. There's no future-proof way to build dashboards including objstore metrics across all Cortex services (because we may change prefixes, add new services, etc). May look a remote possibility, but to give a concrete example @jtlisi is working to use it in the ruler (Transition ruler to use Thanos bucket clients #2543).
  2. It's against how Prometheus was designed (see whole discussion here)

In this PR I propose to:

  1. Remove the metrics prefixing
  2. Adding a {component="name"} label
  3. Instrument the bucket directly in the factory so that we don't forget about it (I forgot in pkg/querier/blocks_store_queryable.go - the bug fix is not mentioned in the CHANGELOG because the whole store-gateway work doesn't appear in the CHANGELOG yet)

Which issue(s) this PR fixes:
N/A

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@pracucci pracucci requested a review from pstibrany May 7, 2020 12:21
@pracucci pracucci force-pushed the cleanup-thanos-objstore-metrics branch from a11e607 to b3e4d36 Compare May 7, 2020 12:25
pracucci added 2 commits May 7, 2020 18:48
Signed-off-by: Marco Pracucci <[email protected]>
Signed-off-by: Marco Pracucci <[email protected]>
@pstibrany
Copy link
Contributor

I would prefer to add instrumentation in tsdb.NewBucketClient instead of individual object-store specific factories. That way it's in the single place, and we always create our bucket clients through that function anyway. WDYT?

@pracucci
Copy link
Contributor Author

pracucci commented May 8, 2020

I would prefer to add instrumentation in tsdb.NewBucketClient instead of individual object-store specific factories. That way it's in the single place, and we always create our bucket clients through that function anyway. WDYT?

I'm OK with it. The reason why I did it for every single backend storage is because the NewBucketClient for a specific backend (ie. s3.NewBucketClient) are exposed and wrapping the instrumentation there would make sure that none forgets about instrumentation either when we use the factory or the single backend. WDYT?

@pstibrany
Copy link
Contributor

I'm OK with it. The reason why I did it for every single backend storage is because the NewBucketClient for a specific backend (ie. s3.NewBucketClient) are exposed and wrapping the instrumentation there would make sure that none forgets about instrumentation either when we use the factory or the single backend. WDYT?

I see your point, but one can also use factory methods from Thanos and then get unwrapped bucket clients. I think we should be consistent. Furthermore our own code inside Cortex doesn't do that (apart from tests). But this isn't a big deal.

Thanks for fixing this, it will make working with these metrics easier.

@pull-request-size pull-request-size bot added size/M and removed size/L labels May 8, 2020
@pracucci
Copy link
Contributor Author

pracucci commented May 8, 2020

I'm OK with it. The reason why I did it for every single backend storage is because the NewBucketClient for a specific backend (ie. s3.NewBucketClient) are exposed and wrapping the instrumentation there would make sure that none forgets about instrumentation either when we use the factory or the single backend. WDYT?

I see your point, but one can also use factory methods from Thanos and then get unwrapped bucket clients. I think we should be consistent. Furthermore our own code inside Cortex doesn't do that (apart from tests). But this isn't a big deal.

Thanks for fixing this, it will make working with these metrics easier.

I've applied your suggestion. Thanks for the review!

Signed-off-by: Marco Pracucci <[email protected]>
@pracucci pracucci merged commit f4a7a7c into cortexproject:master May 8, 2020
@pracucci pracucci deleted the cleanup-thanos-objstore-metrics branch May 8, 2020 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants