feat(influxdb): add alias to query

This commit is contained in:
bergquist
2016-11-09 10:05:12 +01:00
parent 029e52f5a1
commit 24a3a100ed
3 changed files with 5 additions and 0 deletions
+2
View File
@@ -13,6 +13,7 @@ func (qp *InfluxdbQueryParser) Parse(model *simplejson.Json, dsInfo *tsdb.DataSo
policy := model.Get("policy").MustString("default")
rawQuery := model.Get("query").MustString("")
interval := model.Get("interval").MustString("")
alias := model.Get("alias").MustString("")
measurement := model.Get("measurement").MustString("")
@@ -52,6 +53,7 @@ func (qp *InfluxdbQueryParser) Parse(model *simplejson.Json, dsInfo *tsdb.DataSo
Selects: selects,
RawQuery: rawQuery,
Interval: interval,
Alias: alias,
}, nil
}
+2
View File
@@ -90,6 +90,7 @@ func TestInfluxdbQueryParser(t *testing.T) {
}
]
],
"alias": "serie alias",
"tags": [
{
"key": "datacenter",
@@ -115,6 +116,7 @@ func TestInfluxdbQueryParser(t *testing.T) {
So(len(res.Selects), ShouldEqual, 3)
So(len(res.Tags), ShouldEqual, 2)
So(res.Interval, ShouldEqual, ">20s")
So(res.Alias, ShouldEqual, "serie alias")
})
Convey("can part raw query json model", func() {
+1
View File
@@ -8,6 +8,7 @@ type Query struct {
GroupBy []*QueryPart
Selects []*Select
RawQuery string
Alias string
Interval string
}