diff --git a/CHANGELOG.md b/CHANGELOG.md index bb29daf7ff..0235f027c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ We use *breaking :warning:* word for marking changes that are not backward compa * [#3095](https://github.com/thanos-io/thanos/pull/3095) Rule: update manager when all rule files are removed. * [#3098](https://github.com/thanos-io/thanos/pull/3098) ui: Fix Block Viewer for Compactor and Store +* [#3105](https://github.com/thanos-io/thanos/pull/3105) Query: Fix overwriting maxSourceResolution when auto downsampling is enabled. --- sse_config: diff --git a/pkg/api/query/v1.go b/pkg/api/query/v1.go index 7cc30675b2..6cf2b80496 100644 --- a/pkg/api/query/v1.go +++ b/pkg/api/query/v1.go @@ -195,7 +195,8 @@ func (qapi *QueryAPI) parseDownsamplingParamMillis(r *http.Request, defaultVal t val := r.FormValue(maxSourceResolutionParam) if qapi.enableAutodownsampling || (val == "auto") { maxSourceResolution = defaultVal - } else if val != "" { + } + if val != "" && val != "auto" { var err error maxSourceResolution, err = parseDuration(val) if err != nil { diff --git a/pkg/api/query/v1_test.go b/pkg/api/query/v1_test.go index 05a91dcc15..bec886d622 100644 --- a/pkg/api/query/v1_test.go +++ b/pkg/api/query/v1_test.go @@ -1040,6 +1040,14 @@ func TestParseDownsamplingParamMillis(t *testing.T) { result: int64((1 * time.Hour) / 6), fail: true, }, + // maxSourceResolution param can be overwritten. + { + maxSourceResolutionParam: "1m", + enableAutodownsampling: true, + step: time.Hour, + result: int64(time.Minute / (1000 * 1000)), + fail: false, + }, } for i, test := range tests {