prom: add support for default step param (#9866)

Alerting for prometheus have been depending on the step parameter from each query.
In https://github.com/grafana/grafana/pull/9226 we changed the behavior for step in the
frontend which caused problems for alerting. This commit fixes that by introducing a default
min interval value so alerting always have something to depend on. 

closes #9777
This commit is contained in:
Carl Bergquist
2017-11-15 11:22:00 +01:00
committed by GitHub
parent 9e6a7dcb90
commit 5d6ed6c45f
14 changed files with 237 additions and 69 deletions

View File

@@ -2,6 +2,7 @@ package influxdb
import (
"testing"
"time"
"strings"
@@ -38,7 +39,7 @@ func TestInfluxdbQueryBuilder(t *testing.T) {
Measurement: "cpu",
Policy: "policy",
GroupBy: []*QueryPart{groupBy1, groupBy3},
Interval: "10s",
Interval: time.Second * 10,
}
rawQuery, err := query.Build(queryContext)
@@ -52,7 +53,7 @@ func TestInfluxdbQueryBuilder(t *testing.T) {
Measurement: "cpu",
GroupBy: []*QueryPart{groupBy1, groupBy2, groupBy3},
Tags: []*Tag{tag1, tag2},
Interval: "5s",
Interval: time.Second * 5,
}
rawQuery, err := query.Build(queryContext)
@@ -64,7 +65,7 @@ func TestInfluxdbQueryBuilder(t *testing.T) {
query := &Query{
Selects: []*Select{{*qp1, *qp2, *mathPartDivideBy100}},
Measurement: "cpu",
Interval: "5s",
Interval: time.Second * 5,
}
rawQuery, err := query.Build(queryContext)
@@ -76,7 +77,7 @@ func TestInfluxdbQueryBuilder(t *testing.T) {
query := &Query{
Selects: []*Select{{*qp1, *qp2, *mathPartDivideByIntervalMs}},
Measurement: "cpu",
Interval: "5s",
Interval: time.Second * 5,
}
rawQuery, err := query.Build(queryContext)
@@ -117,7 +118,7 @@ func TestInfluxdbQueryBuilder(t *testing.T) {
Measurement: "cpu",
Policy: "policy",
GroupBy: []*QueryPart{groupBy1, groupBy3},
Interval: "10s",
Interval: time.Second * 10,
RawQuery: "Raw query",
UseRawQuery: true,
}