Skip to content

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

Merged
kakkoyun merged 33 commits intothanos-io:masterfrom
krasi-georgiev:memcached-query
Sep 18, 2020
Merged

Use more of the cortex frontend module to deduplicate some code and add the memcached backend#3114
kakkoyun merged 33 commits intothanos-io:masterfrom
krasi-georgiev:memcached-query

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.

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>
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?

@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>
@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?

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!

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?

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 🚀

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