Refactor query config field arguments to be fields
parent
3ba1a4c94d
commit
3c1b09704e
|
@ -495,10 +495,10 @@ type TriggerValues struct {
|
|||
|
||||
// Field represent influxql fields and functions from the UI
|
||||
type Field struct {
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
Alias string `json:"alias"`
|
||||
Args []string `json:"args"`
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
Alias string `json:"alias"`
|
||||
Args []Field `json:"args"`
|
||||
}
|
||||
|
||||
// GroupBy represents influxql group by tags from the UI
|
||||
|
|
|
@ -121,16 +121,12 @@ func Convert(influxQL string) (chronograf.QueryConfig, error) {
|
|||
return raw, nil
|
||||
case influxql.NullFill:
|
||||
qc.Fill = "null"
|
||||
|
||||
case influxql.NoFill:
|
||||
qc.Fill = "none"
|
||||
|
||||
case influxql.NumberFill:
|
||||
qc.Fill = fmt.Sprint(stmt.FillValue)
|
||||
|
||||
case influxql.PreviousFill:
|
||||
qc.Fill = "previous"
|
||||
|
||||
case influxql.LinearFill:
|
||||
qc.Fill = "linear"
|
||||
|
||||
|
@ -167,7 +163,12 @@ func Convert(influxQL string) (chronograf.QueryConfig, error) {
|
|||
Name: f.Name,
|
||||
Type: "func",
|
||||
Alias: fld.Alias,
|
||||
Args: []string{ref.Val},
|
||||
Args: []chronograf.Field{
|
||||
{
|
||||
Name: ref.Val,
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
})
|
||||
case *influxql.VarRef:
|
||||
if f.Type != influxql.Unknown {
|
||||
|
@ -177,7 +178,6 @@ func Convert(influxQL string) (chronograf.QueryConfig, error) {
|
|||
Name: f.Val,
|
||||
Type: "field",
|
||||
Alias: fld.Alias,
|
||||
Args: []string{},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,22 +26,18 @@ func TestConvert(t *testing.T) {
|
|||
chronograf.Field{
|
||||
Name: "usage_idle",
|
||||
Type: "field",
|
||||
Args: []string{},
|
||||
},
|
||||
chronograf.Field{
|
||||
Name: "usage_guest_nice",
|
||||
Type: "field",
|
||||
Args: []string{},
|
||||
},
|
||||
chronograf.Field{
|
||||
Name: "usage_system",
|
||||
Type: "field",
|
||||
Args: []string{},
|
||||
},
|
||||
chronograf.Field{
|
||||
Name: "usage_guest",
|
||||
Type: "field",
|
||||
Args: []string{},
|
||||
},
|
||||
},
|
||||
Tags: map[string][]string{},
|
||||
|
@ -61,22 +57,42 @@ func TestConvert(t *testing.T) {
|
|||
chronograf.Field{
|
||||
Name: "mean",
|
||||
Type: "func",
|
||||
Args: []string{"usage_idle"},
|
||||
Args: []chronograf.Field{
|
||||
{
|
||||
Name: "usage_idle",
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
},
|
||||
chronograf.Field{
|
||||
Name: "median",
|
||||
Type: "func",
|
||||
Args: []string{"usage_idle"},
|
||||
Args: []chronograf.Field{
|
||||
{
|
||||
Name: "usage_idle",
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
},
|
||||
chronograf.Field{
|
||||
Name: "count",
|
||||
Type: "func",
|
||||
Args: []string{"usage_guest_nice"},
|
||||
Args: []chronograf.Field{
|
||||
{
|
||||
Name: "usage_guest_nice",
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
},
|
||||
chronograf.Field{
|
||||
Name: "mean",
|
||||
Type: "func",
|
||||
Args: []string{"usage_guest_nice"},
|
||||
Args: []chronograf.Field{
|
||||
{
|
||||
Name: "usage_guest_nice",
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Tags: map[string][]string{},
|
||||
|
@ -120,7 +136,6 @@ func TestConvert(t *testing.T) {
|
|||
chronograf.Field{
|
||||
Name: "usage_user",
|
||||
Type: "field",
|
||||
Args: []string{},
|
||||
},
|
||||
},
|
||||
Tags: map[string][]string{"host": []string{"myhost"}},
|
||||
|
@ -157,7 +172,6 @@ func TestConvert(t *testing.T) {
|
|||
chronograf.Field{
|
||||
Name: "usage_user",
|
||||
Type: "field",
|
||||
Args: []string{},
|
||||
},
|
||||
},
|
||||
Tags: map[string][]string{"host": []string{"myhost"}},
|
||||
|
@ -183,7 +197,6 @@ func TestConvert(t *testing.T) {
|
|||
chronograf.Field{
|
||||
Name: "usage_user",
|
||||
Type: "field",
|
||||
Args: []string{},
|
||||
},
|
||||
},
|
||||
GroupBy: chronograf.GroupBy{
|
||||
|
@ -231,7 +244,6 @@ func TestConvert(t *testing.T) {
|
|||
chronograf.Field{
|
||||
Name: "usage_user",
|
||||
Type: "field",
|
||||
Args: []string{},
|
||||
},
|
||||
},
|
||||
Tags: map[string][]string{},
|
||||
|
@ -252,7 +264,6 @@ func TestConvert(t *testing.T) {
|
|||
chronograf.Field{
|
||||
Name: "usage_user",
|
||||
Type: "field",
|
||||
Args: []string{},
|
||||
},
|
||||
},
|
||||
Tags: map[string][]string{"host": []string{"myhost"}},
|
||||
|
@ -278,7 +289,6 @@ func TestConvert(t *testing.T) {
|
|||
chronograf.Field{
|
||||
Name: "usage_user",
|
||||
Type: "field",
|
||||
Args: []string{},
|
||||
},
|
||||
},
|
||||
Tags: map[string][]string{
|
||||
|
@ -323,7 +333,6 @@ func TestConvert(t *testing.T) {
|
|||
chronograf.Field{
|
||||
Name: "usage_user",
|
||||
Type: "field",
|
||||
Args: []string{},
|
||||
},
|
||||
},
|
||||
Tags: map[string][]string{
|
||||
|
@ -351,22 +360,18 @@ func TestConvert(t *testing.T) {
|
|||
chronograf.Field{
|
||||
Name: "usage_idle",
|
||||
Type: "field",
|
||||
Args: []string{},
|
||||
},
|
||||
chronograf.Field{
|
||||
Name: "usage_guest_nice",
|
||||
Type: "field",
|
||||
Args: []string{},
|
||||
},
|
||||
chronograf.Field{
|
||||
Name: "usage_system",
|
||||
Type: "field",
|
||||
Args: []string{},
|
||||
},
|
||||
chronograf.Field{
|
||||
Name: "usage_guest",
|
||||
Type: "field",
|
||||
Args: []string{},
|
||||
},
|
||||
},
|
||||
Tags: map[string][]string{
|
||||
|
@ -402,22 +407,18 @@ func TestConvert(t *testing.T) {
|
|||
chronograf.Field{
|
||||
Name: "usage_idle",
|
||||
Type: "field",
|
||||
Args: []string{},
|
||||
},
|
||||
chronograf.Field{
|
||||
Name: "usage_guest_nice",
|
||||
Type: "field",
|
||||
Args: []string{},
|
||||
},
|
||||
chronograf.Field{
|
||||
Name: "usage_system",
|
||||
Type: "field",
|
||||
Args: []string{},
|
||||
},
|
||||
chronograf.Field{
|
||||
Name: "usage_guest",
|
||||
Type: "field",
|
||||
Args: []string{},
|
||||
},
|
||||
},
|
||||
Tags: map[string][]string{
|
||||
|
@ -453,8 +454,11 @@ func TestConvert(t *testing.T) {
|
|||
chronograf.Field{
|
||||
Name: "mean",
|
||||
Type: "func",
|
||||
Args: []string{
|
||||
"usage_idle",
|
||||
Args: []chronograf.Field{
|
||||
{
|
||||
Name: "usage_idle",
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -481,8 +485,11 @@ func TestConvert(t *testing.T) {
|
|||
chronograf.Field{
|
||||
Name: "mean",
|
||||
Type: "func",
|
||||
Args: []string{
|
||||
"usage_idle",
|
||||
Args: []chronograf.Field{
|
||||
{
|
||||
Name: "usage_idle",
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -509,8 +516,11 @@ func TestConvert(t *testing.T) {
|
|||
chronograf.Field{
|
||||
Name: "mean",
|
||||
Type: "func",
|
||||
Args: []string{
|
||||
"usage_idle",
|
||||
Args: []chronograf.Field{
|
||||
{
|
||||
Name: "usage_idle",
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -537,8 +547,11 @@ func TestConvert(t *testing.T) {
|
|||
chronograf.Field{
|
||||
Name: "mean",
|
||||
Type: "func",
|
||||
Args: []string{
|
||||
"usage_idle",
|
||||
Args: []chronograf.Field{
|
||||
{
|
||||
Name: "usage_idle",
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -565,8 +578,11 @@ func TestConvert(t *testing.T) {
|
|||
chronograf.Field{
|
||||
Name: "mean",
|
||||
Type: "func",
|
||||
Args: []string{
|
||||
"usage_idle",
|
||||
Args: []chronograf.Field{
|
||||
{
|
||||
Name: "usage_idle",
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -427,7 +427,12 @@ func Reverse(script chronograf.TICKScript) (chronograf.AlertRule, error) {
|
|||
{
|
||||
Type: "func",
|
||||
Name: fieldFunc.Func,
|
||||
Args: []string{fieldFunc.Field},
|
||||
Args: []chronograf.Field{
|
||||
{
|
||||
Name: fieldFunc.Field,
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
} else {
|
||||
|
@ -435,7 +440,6 @@ func Reverse(script chronograf.TICKScript) (chronograf.AlertRule, error) {
|
|||
{
|
||||
Type: "field",
|
||||
Name: fieldFunc.Field,
|
||||
Args: []string{},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,7 +114,12 @@ func TestReverse(t *testing.T) {
|
|||
Fields: []chronograf.Field{
|
||||
{
|
||||
Name: "mean",
|
||||
Args: []string{"usage_user"},
|
||||
Args: []chronograf.Field{
|
||||
{
|
||||
Name: "usage_user",
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
Type: "func",
|
||||
},
|
||||
},
|
||||
|
@ -222,7 +227,12 @@ func TestReverse(t *testing.T) {
|
|||
Fields: []chronograf.Field{
|
||||
{
|
||||
Name: "mean",
|
||||
Args: []string{"usage_user"},
|
||||
Args: []chronograf.Field{
|
||||
{
|
||||
Name: "usage_user",
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
Type: "func",
|
||||
},
|
||||
},
|
||||
|
@ -362,7 +372,12 @@ func TestReverse(t *testing.T) {
|
|||
Fields: []chronograf.Field{
|
||||
{
|
||||
Name: "last",
|
||||
Args: []string{"status"},
|
||||
Args: []chronograf.Field{
|
||||
{
|
||||
Name: "status",
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
Type: "func",
|
||||
},
|
||||
},
|
||||
|
@ -478,7 +493,12 @@ func TestReverse(t *testing.T) {
|
|||
Fields: []chronograf.Field{
|
||||
{
|
||||
Name: "last",
|
||||
Args: []string{"status"},
|
||||
Args: []chronograf.Field{
|
||||
{
|
||||
Name: "status",
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
Type: "func",
|
||||
},
|
||||
},
|
||||
|
@ -596,7 +616,12 @@ func TestReverse(t *testing.T) {
|
|||
Fields: []chronograf.Field{
|
||||
{
|
||||
Name: "mean",
|
||||
Args: []string{"usage_user"},
|
||||
Args: []chronograf.Field{
|
||||
{
|
||||
Name: "usage_user",
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
Type: "func",
|
||||
},
|
||||
},
|
||||
|
@ -722,7 +747,12 @@ func TestReverse(t *testing.T) {
|
|||
Fields: []chronograf.Field{
|
||||
{
|
||||
Name: "mean",
|
||||
Args: []string{"usage_user"},
|
||||
Args: []chronograf.Field{
|
||||
{
|
||||
Name: "usage_user",
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
Type: "func",
|
||||
},
|
||||
},
|
||||
|
@ -848,7 +878,12 @@ func TestReverse(t *testing.T) {
|
|||
Fields: []chronograf.Field{
|
||||
{
|
||||
Name: "mean",
|
||||
Args: []string{"usage_user"},
|
||||
Args: []chronograf.Field{
|
||||
{
|
||||
Name: "usage_user",
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
Type: "func",
|
||||
},
|
||||
},
|
||||
|
@ -962,7 +997,6 @@ func TestReverse(t *testing.T) {
|
|||
Fields: []chronograf.Field{
|
||||
{
|
||||
Name: "usage_user",
|
||||
Args: []string{},
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
|
@ -1098,7 +1132,12 @@ trigger
|
|||
Fields: []chronograf.Field{
|
||||
{
|
||||
Name: "mean",
|
||||
Args: []string{"usage_user"},
|
||||
Args: []chronograf.Field{
|
||||
{
|
||||
Name: "usage_user",
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
Type: "func",
|
||||
},
|
||||
},
|
||||
|
@ -1235,7 +1274,12 @@ trigger
|
|||
Fields: []chronograf.Field{
|
||||
{
|
||||
Name: "mean",
|
||||
Args: []string{"usage_user"},
|
||||
Args: []chronograf.Field{
|
||||
{
|
||||
Name: "usage_user",
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
Type: "func",
|
||||
},
|
||||
},
|
||||
|
@ -1451,7 +1495,6 @@ trigger
|
|||
Fields: []chronograf.Field{
|
||||
{
|
||||
Name: "queryOk",
|
||||
Args: []string{},
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
|
|
|
@ -324,7 +324,6 @@ trigger
|
|||
{
|
||||
Name: "queryOk",
|
||||
Type: "field",
|
||||
Args: []string{},
|
||||
},
|
||||
},
|
||||
GroupBy: chronograf.GroupBy{
|
||||
|
@ -648,7 +647,6 @@ trigger
|
|||
{
|
||||
Name: "queryOk",
|
||||
Type: "field",
|
||||
Args: []string{},
|
||||
},
|
||||
},
|
||||
GroupBy: chronograf.GroupBy{
|
||||
|
|
|
@ -41,10 +41,10 @@ func Data(rule chronograf.AlertRule) (string, error) {
|
|||
}
|
||||
value := ""
|
||||
for _, field := range rule.Query.Fields {
|
||||
if field.Type == "func" && len(field.Args) > 0 {
|
||||
if field.Type == "func" && len(field.Args) > 0 && field.Args[0].Type == "field" {
|
||||
// Only need a window if we have an aggregate function
|
||||
value = value + "|window().period(period).every(every).align()\n"
|
||||
value = value + fmt.Sprintf(`|%s('%s').as('value')`, field.Name, field.Args[0])
|
||||
value = value + fmt.Sprintf(`|%s('%s').as('value')`, field.Name, field.Args[0].Name)
|
||||
break // only support a single field
|
||||
}
|
||||
if value != "" {
|
||||
|
|
|
@ -33,7 +33,12 @@ func TestInfluxOut(t *testing.T) {
|
|||
{
|
||||
Name: "mean",
|
||||
Type: "func",
|
||||
Args: []string{"usage_user"},
|
||||
Args: []chronograf.Field{
|
||||
{
|
||||
Name: "usage_user",
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/influxdata/chronograf"
|
||||
"github.com/sergi/go-diff/diffmatchpatch"
|
||||
)
|
||||
|
@ -28,7 +29,12 @@ func TestGenerate(t *testing.T) {
|
|||
{
|
||||
Name: "mean",
|
||||
Type: "func",
|
||||
Args: []string{"usage_user"},
|
||||
Args: []chronograf.Field{
|
||||
{
|
||||
Name: "usage_user",
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Tags: map[string][]string{
|
||||
|
@ -74,7 +80,12 @@ func TestThreshold(t *testing.T) {
|
|||
{
|
||||
Name: "mean",
|
||||
Type: "func",
|
||||
Args: []string{"usage_user"},
|
||||
Args: []chronograf.Field{
|
||||
{
|
||||
Name: "usage_user",
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Tags: map[string][]string{
|
||||
|
@ -219,7 +230,12 @@ func TestThresholdStringCrit(t *testing.T) {
|
|||
{
|
||||
Name: "last",
|
||||
Type: "func",
|
||||
Args: []string{"status"},
|
||||
Args: []chronograf.Field{
|
||||
{
|
||||
Name: "status",
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
GroupBy: chronograf.GroupBy{
|
||||
|
@ -358,7 +374,12 @@ func TestThresholdStringCritGreater(t *testing.T) {
|
|||
{
|
||||
Name: "last",
|
||||
Type: "func",
|
||||
Args: []string{"status"},
|
||||
Args: []chronograf.Field{
|
||||
{
|
||||
Name: "status",
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
GroupBy: chronograf.GroupBy{
|
||||
|
@ -495,7 +516,12 @@ func TestThresholdDetail(t *testing.T) {
|
|||
{
|
||||
Name: "mean",
|
||||
Type: "func",
|
||||
Args: []string{"usage_user"},
|
||||
Args: []chronograf.Field{
|
||||
{
|
||||
Name: "usage_user",
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Tags: map[string][]string{
|
||||
|
@ -643,7 +669,12 @@ func TestThresholdInsideRange(t *testing.T) {
|
|||
{
|
||||
Name: "mean",
|
||||
Type: "func",
|
||||
Args: []string{"usage_user"},
|
||||
Args: []chronograf.Field{
|
||||
{
|
||||
Name: "usage_user",
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Tags: map[string][]string{
|
||||
|
@ -790,7 +821,12 @@ func TestThresholdOutsideRange(t *testing.T) {
|
|||
{
|
||||
Name: "mean",
|
||||
Type: "func",
|
||||
Args: []string{"usage_user"},
|
||||
Args: []chronograf.Field{
|
||||
{
|
||||
Name: "usage_user",
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Tags: map[string][]string{
|
||||
|
@ -936,7 +972,6 @@ func TestThresholdNoAggregate(t *testing.T) {
|
|||
{
|
||||
Name: "usage_user",
|
||||
Type: "field",
|
||||
Args: []string{},
|
||||
},
|
||||
},
|
||||
Tags: map[string][]string{
|
||||
|
@ -1074,7 +1109,12 @@ func TestRelative(t *testing.T) {
|
|||
{
|
||||
Name: "mean",
|
||||
Type: "func",
|
||||
Args: []string{"usage_user"},
|
||||
Args: []chronograf.Field{
|
||||
{
|
||||
Name: "usage_user",
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Tags: map[string][]string{
|
||||
|
@ -1232,7 +1272,12 @@ func TestRelativeChange(t *testing.T) {
|
|||
{
|
||||
Name: "mean",
|
||||
Type: "func",
|
||||
Args: []string{"usage_user"},
|
||||
Args: []chronograf.Field{
|
||||
{
|
||||
Name: "usage_user",
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Tags: map[string][]string{
|
||||
|
@ -1387,7 +1432,12 @@ func TestDeadman(t *testing.T) {
|
|||
{
|
||||
Name: "mean",
|
||||
Type: "func",
|
||||
Args: []string{"usage_user"},
|
||||
Args: []chronograf.Field{
|
||||
{
|
||||
Name: "usage_user",
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Tags: map[string][]string{
|
||||
|
@ -1499,9 +1549,7 @@ trigger
|
|||
continue
|
||||
}
|
||||
if got != tt.want {
|
||||
diff := diffmatchpatch.New()
|
||||
delta := diff.DiffMain(string(tt.want), string(got), true)
|
||||
t.Errorf("%q\n%s", tt.name, diff.DiffPrettyText(delta))
|
||||
t.Errorf("%q\n%s", tt.name, cmp.Diff(string(tt.want), string(got)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -154,7 +154,12 @@ func field(q *chronograf.QueryConfig) (string, error) {
|
|||
if q != nil {
|
||||
for _, field := range q.Fields {
|
||||
if field.Type == "func" && len(field.Args) > 0 {
|
||||
return field.Args[0], nil
|
||||
for _, arg := range field.Args {
|
||||
if arg.Type == "field" {
|
||||
return arg.Name, nil
|
||||
}
|
||||
}
|
||||
return "", fmt.Errorf("No fields set in query")
|
||||
}
|
||||
return field.Name, nil
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ func TestVarsCritStringEqual(t *testing.T) {
|
|||
{
|
||||
Name: "status",
|
||||
Type: "field",
|
||||
Args: []string{},
|
||||
},
|
||||
},
|
||||
GroupBy: chronograf.GroupBy{
|
||||
|
|
|
@ -313,7 +313,6 @@ func Test_newDashboardResponse(t *testing.T) {
|
|||
{
|
||||
Type: "field",
|
||||
Name: "winning_horses",
|
||||
Args: []string{},
|
||||
},
|
||||
},
|
||||
GroupBy: chronograf.GroupBy{
|
||||
|
|
|
@ -381,12 +381,6 @@ func newAlertResponse(task *kapa.Task, srcID, kapaID int) *alertResponse {
|
|||
res.Query.Fields = make([]chronograf.Field, 0)
|
||||
}
|
||||
|
||||
for _, f := range res.Query.Fields {
|
||||
if f.Type == "func" && f.Args == nil {
|
||||
f.Args = make([]string, 0)
|
||||
}
|
||||
}
|
||||
|
||||
if res.Query.GroupBy.Tags == nil {
|
||||
res.Query.GroupBy.Tags = make([]string, 0)
|
||||
}
|
||||
|
|
|
@ -39,7 +39,12 @@ func TestValidRuleRequest(t *testing.T) {
|
|||
{
|
||||
Name: "max",
|
||||
Type: "func",
|
||||
Args: []string{"oldmanpeabody"},
|
||||
Args: []chronograf.Field{
|
||||
{
|
||||
Name: "oldmanpeabody",
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -55,7 +60,12 @@ func TestValidRuleRequest(t *testing.T) {
|
|||
{
|
||||
Name: "max",
|
||||
Type: "func",
|
||||
Args: []string{"oldmanpeabody"},
|
||||
Args: []chronograf.Field{
|
||||
{
|
||||
Name: "oldmanpeabody",
|
||||
Type: "field",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue