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

Correctly handle auto downsampling in codec #3073

Merged
merged 2 commits into from
Aug 26, 2020

Conversation

yeya24
Copy link
Contributor

@yeya24 yeya24 commented Aug 25, 2020

Signed-off-by: Ben Ye yb532204897@gmail.com

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

Changes

  1. Handle max_source_resolution=auto correctly.
  2. Generating cache key based on resolution level instead of time

Verification

Signed-off-by: Ben Ye <yb532204897@gmail.com>
@yeya24 yeya24 requested a review from bwplotka August 25, 2020 12:03
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.

Some suggestions only. LGTM! (:

pkg/queryfrontend/cache_splitter.go Show resolved Hide resolved

// TODO(yeya24): Add other request params as request key.
// GenerateCacheKey generates a cache key based on the Request and interval.
func (t constSplitter) GenerateCacheKey(_ string, r queryrange.Request) string {
currentInterval := r.GetStart() / time.Duration(t).Milliseconds()
func (t thanosCacheSplitter) GenerateCacheKey(_ string, r queryrange.Request) string {
Copy link
Member

Choose a reason for hiding this comment

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

It's not splitter anymore, rather cacheKeyGenerator ? (:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's better

for _, tc := range []struct {
name string
req queryrange.Request
expectedCacheKey string
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
expectedCacheKey string
expected string

pkg/queryfrontend/cache_splitter.go Show resolved Hide resolved
@@ -300,6 +300,16 @@ func TestRoundTripCacheMiddleware(t *testing.T) {
MaxSourceResolution: 10 * seconds,
}

// same query params as testRequest, different maxSourceResolution
Copy link
Member

Choose a reason for hiding this comment

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

Can we start comments with upper case letter like normal sentence?

name: "do it again",
req: testRequest2,
name: "different max source resolution and different level",
req: testRequest4,
Copy link
Member

Choose a reason for hiding this comment

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

why not inlining those requests maybe?

Signed-off-by: Ben Ye <yb532204897@gmail.com>
@yeya24 yeya24 requested a review from bwplotka August 25, 2020 16:18
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.

💪 LGTM!

Thanks!

@bwplotka bwplotka merged commit 1424f0c into thanos-io:master Aug 26, 2020
@yeya24 yeya24 deleted the support-auto-downsampling branch August 26, 2020 14:04
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.

2 participants