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

Use more of the cortex frontend module to deduplicate some code and add the memcached backend #3114

Merged
merged 33 commits into from
Sep 18, 2020

Conversation

krasi-georgiev
Copy link
Contributor

@krasi-georgiev krasi-georgiev commented Sep 2, 2020

taking over for Bens PR :#3032

Signed-off-by: Krasi Georgiev 8903888+krasi-georgiev@users.noreply.github.com

Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

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

Though this pr is still a draft, I just take an initial look. Hope you don't mind.

We are reusing Cortex config directly here. My idea is:

We can reuse the Cortex cache config. But it is not very good to reuse its Limits and QueryRange config, they contain some unnecessary fields for Thanos so what about using our own? It wouldn't be too much code to maintain, just some structs/type conversion between Cortex and Thanos.

cmd/thanos/query-frontend.go Show resolved Hide resolved
cmd/thanos/query-frontend.go Outdated Show resolved Hide resolved
cmd/thanos/query-frontend.go Outdated Show resolved Hide resolved
docs/components/query-frontend.md Outdated Show resolved Hide resolved
docs/components/query-frontend.md Outdated Show resolved Hide resolved
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
@krasi-georgiev
Copy link
Contributor Author

Though this pr is still a draft, I just take an initial look. Hope you don't mind.

We are reusing Cortex config directly here. My idea is:

We can reuse the Cortex cache config. But it is not very good to reuse its Limits and QueryRange config, they contain some unnecessary fields for Thanos so what about using our own? It wouldn't be too much code to maintain, just some structs/type conversion between Cortex and Thanos.

Yep I removed the Limits we can stil use the constructor though.

Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
docs/components/query-frontend.md Show resolved Hide resolved
docs/components/query-frontend.md Outdated Show resolved Hide resolved
pkg/queryfrontend/roundtrip.go Show resolved Hide resolved
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
@kakkoyun
Copy link
Member

kakkoyun commented Sep 7, 2020

@krasi-georgiev I believe this will add support for memcached as a cache backend. Could you please update the title and changelog accordingly?

CHANGELOG.md Outdated Show resolved Hide resolved
@krasi-georgiev krasi-georgiev changed the title [WIP] Use more of the cortex frontend module to deduplicate a lot code [WIP] Use more of the cortex frontend module to deduplicate a lot code and add all supported backends by cortex Sep 7, 2020
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
@krasi-georgiev
Copy link
Contributor Author

@krasi-georgiev I believe this will add support for memcached as a cache backend. Could you please update the title and changelog accordingly?

updated thanks

Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
@krasi-georgiev krasi-georgiev marked this pull request as ready for review September 7, 2020 14:26
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
@krasi-georgiev krasi-georgiev changed the title [WIP] Use more of the cortex frontend module to deduplicate a lot code and add all supported backends by cortex Use more of the cortex frontend module to deduplicate a lot code and add all supported backends by cortex Sep 7, 2020
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
docs/components/query-frontend.md Outdated Show resolved Hide resolved
pkg/queryfrontend/config.go Outdated Show resolved Hide resolved
cmd/thanos/query-frontend.go Outdated Show resolved Hide resolved
cmd/thanos/query-frontend.go Outdated Show resolved Hide resolved
pkg/queryfrontend/roundtrip.go Outdated Show resolved Hide resolved
@krasi-georgiev krasi-georgiev force-pushed the memcached-query branch 2 times, most recently from 0a9ed13 to b0bef06 Compare September 7, 2020 15:34
Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

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

Thanks for all the work! 🥇

From my point of view, it is all good, just need to update the tests. Can I have some other 👀 to review this pr @kakkoyun @squat? Also some flags name and configs are changed, it would be good to add these changes to the changelog.

The Cortex cache config is a little bit complex, it would be good to add a Cortex doc link https://cortexmetrics.io/docs/configuration/configuration-file/. What do you think?

cmd/thanos/query-frontend.go Outdated Show resolved Hide resolved
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
@krasi-georgiev krasi-georgiev changed the title Use more of the cortex frontend module to deduplicate a lot code and add all supported backends by cortex Use more of the cortex frontend module to deduplicate a lot code and add the memcached backend Sep 14, 2020
@krasi-georgiev krasi-georgiev changed the title Use more of the cortex frontend module to deduplicate a lot code and add the memcached backend Use more of the cortex frontend module to deduplicate some code and add the memcached backend Sep 14, 2020
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
@krasi-georgiev
Copy link
Contributor Author

refactored to be consistent with the other Thanos cache components

please take another look @kakkoyun @bwplotka @yeya24

Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
Copy link
Member

@kakkoyun kakkoyun left a comment

Choose a reason for hiding this comment

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

LGTM. Let's what others also think.

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.

Awesome, minor nits only otherwise LGTM, thanks!

cmd/thanos/query-frontend.go Outdated Show resolved Hide resolved
Addresses: strings.Join(config.Memcached.Addresses, ","),
UpdateInterval: config.Memcached.DNSProviderUpdateInterval,
},
Background: cortexcache.BackgroundConfig{
Copy link
Member

Choose a reason for hiding this comment

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

BackgroundConfig 👀

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Anything looks strange here?

test/e2e/query_frontend_test.go Show resolved Hide resolved
test/e2e/query_test.go Show resolved Hide resolved
Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

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

Some very small nits, overall LGTM 🚀

pkg/queryfrontend/config.go Show resolved Hide resolved
pkg/queryfrontend/config.go Outdated Show resolved Hide resolved
pkg/queryfrontend/roundtrip.go Outdated Show resolved Hide resolved
pkg/queryfrontend/config.go Show resolved Hide resolved
scripts/cfggen/main.go Outdated Show resolved Hide resolved
test/e2e/e2ethanos/services.go Outdated Show resolved Hide resolved
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

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

LGTM!

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.

4 participants