Commit 4c8f417f by Erik Sundell Committed by Daniel Lee

Stackdriver: Add extra alignment period options (#18909)

* Add more alignment period options

* Remove unnecessary alignment period limit
parent b6c501bc
......@@ -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{}{
......
......@@ -233,11 +233,15 @@ export const alignmentPeriods = [
{ text: 'grafana auto', value: 'grafana-auto' },
{ text: 'stackdriver auto', value: 'stackdriver-auto' },
{ text: '1m', value: '+60s' },
{ text: '2m', value: '+120s' },
{ text: '5m', value: '+300s' },
{ text: '10m', value: '+600s' },
{ text: '30m', value: '+1800s' },
{ text: '1h', value: '+3600s' },
{ text: '3h', value: '+7200s' },
{ text: '6h', value: '+21600s' },
{ text: '1d', value: '+86400s' },
{ text: '3d', value: '+259200s' },
{ text: '1w', value: '+604800s' },
];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment