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 (#3105)

* Fix overwriting maxSourceResolution when auto downsampling is enabled

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

* add changelog

Signed-off-by: Ben Ye <yb532204897@gmail.com>
  • Loading branch information
yeya24 authored Sep 1, 2020
1 parent f89e099 commit 7d7d176
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 @@ -15,6 +15,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.

## [v0.15.0-rc.0](https://github.com/thanos-io/thanos/releases/tag/v0.15.0-rc.0) - 2020.08.26

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

Please sign in to comment.