mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Stackdriver: Add extra alignment period options (#18909)
* Add more alignment period options * Remove unnecessary alignment period limit
This commit is contained in:
@@ -261,12 +261,6 @@ func setAggParams(params *url.Values, query *tsdb.Query, durationSeconds int) {
|
||||
}
|
||||
}
|
||||
|
||||
re := regexp.MustCompile("[0-9]+")
|
||||
seconds, err := strconv.ParseInt(re.FindString(alignmentPeriod), 10, 64)
|
||||
if err != nil || seconds > 3600 {
|
||||
alignmentPeriod = "+3600s"
|
||||
}
|
||||
|
||||
params.Add("aggregation.crossSeriesReducer", crossSeriesReducer)
|
||||
params.Add("aggregation.perSeriesAligner", perSeriesAligner)
|
||||
params.Add("aggregation.alignmentPeriod", alignmentPeriod)
|
||||
|
||||
@@ -147,17 +147,6 @@ func TestStackdriver(t *testing.T) {
|
||||
})
|
||||
|
||||
Convey("and alignmentPeriod is set in frontend", func() {
|
||||
Convey("and alignment period is too big", func() {
|
||||
tsdbQuery.Queries[0].IntervalMs = 1000
|
||||
tsdbQuery.Queries[0].Model = simplejson.NewFromAny(map[string]interface{}{
|
||||
"alignmentPeriod": "+360000s",
|
||||
})
|
||||
|
||||
queries, err := executor.buildQueries(tsdbQuery)
|
||||
So(err, ShouldBeNil)
|
||||
So(queries[0].Params["aggregation.alignmentPeriod"][0], ShouldEqual, `+3600s`)
|
||||
})
|
||||
|
||||
Convey("and alignment period is within accepted range", func() {
|
||||
tsdbQuery.Queries[0].IntervalMs = 1000
|
||||
tsdbQuery.Queries[0].Model = simplejson.NewFromAny(map[string]interface{}{
|
||||
|
||||
Reference in New Issue
Block a user