change fillmode from last to previous

This commit is contained in:
Sven Klemm
2018-08-07 21:01:41 +02:00
parent 83d7ec1da2
commit ee7602ec1f
10 changed files with 21 additions and 22 deletions
+2 -2
View File
@@ -119,8 +119,8 @@ func (m *postgresMacroEngine) evaluateMacro(name string, args []string) (string,
switch args[2] {
case "NULL":
m.query.Model.Set("fillMode", "null")
case "last":
m.query.Model.Set("fillMode", "last")
case "previous":
m.query.Model.Set("fillMode", "previous")
default:
m.query.Model.Set("fillMode", "value")
floatVal, err := strconv.ParseFloat(args[2], 64)
+2 -2
View File
@@ -303,12 +303,12 @@ func TestPostgres(t *testing.T) {
})
})
Convey("When doing a metric query using timeGroup with last fill enabled", func() {
Convey("When doing a metric query using timeGroup with previous fill enabled", func() {
query := &tsdb.TsdbQuery{
Queries: []*tsdb.Query{
{
Model: simplejson.NewFromAny(map[string]interface{}{
"rawSql": "SELECT $__timeGroup(time, '5m', last), avg(value) as value FROM metric GROUP BY 1 ORDER BY 1",
"rawSql": "SELECT $__timeGroup(time, '5m', previous), avg(value) as value FROM metric GROUP BY 1 ORDER BY 1",
"format": "time_series",
}),
RefId: "A",