Skip to content

Commit

Permalink
querier: Fix overwriting maxSourceResolution when auto downsampling i…
Browse files Browse the repository at this point in the history
…s enabled (thanos-io#3105)

* Fix overwriting maxSourceResolution when auto downsampling is enabled

Signed-off-by: Ben Ye <[email protected]>

* add changelog

Signed-off-by: Ben Ye <[email protected]>
Signed-off-by: Kemal Akkoyun <[email protected]>
  • Loading branch information
yeya24 authored and kakkoyun committed Sep 7, 2020
1 parent f02d941 commit 3710a67
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion pkg/api/query/v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 8 additions & 0 deletions pkg/api/query/v1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 3710a67

Please sign in to comment.