stackdriver: making sure we dont pass too big alignmentPeriods to the stackdriver api

This commit is contained in:
Erik Sundell
2018-09-17 17:13:06 +02:00
parent f839d12de4
commit edf38f040d
2 changed files with 30 additions and 0 deletions
+6
View File
@@ -163,6 +163,12 @@ func setAggParams(params *url.Values, query *tsdb.Query) {
alignmentPeriod = "+" + strconv.Itoa(alignmentPeriodValue) + "s"
}
re := regexp.MustCompile("[0-9]+")
aa, err := strconv.ParseInt(re.FindString(alignmentPeriod), 10, 64)
if err != nil || aa > 3600 {
alignmentPeriod = "+3600s"
}
params.Add("aggregation.crossSeriesReducer", primaryAggregation)
params.Add("aggregation.perSeriesAligner", perSeriesAligner)
params.Add("aggregation.alignmentPeriod", alignmentPeriod)