|
@@ -295,7 +295,7 @@ func TestMySQL(t *testing.T) {
|
|
|
|
|
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- Convey("When doing a metric query using timeGroup with float fill enabled", func() {
|
|
|
|
|
|
|
+ Convey("When doing a metric query using timeGroup with value fill enabled", func() {
|
|
|
query := &tsdb.TsdbQuery{
|
|
query := &tsdb.TsdbQuery{
|
|
|
Queries: []*tsdb.Query{
|
|
Queries: []*tsdb.Query{
|
|
|
{
|
|
{
|
|
@@ -320,6 +320,35 @@ func TestMySQL(t *testing.T) {
|
|
|
points := queryResult.Series[0].Points
|
|
points := queryResult.Series[0].Points
|
|
|
So(points[3][0].Float64, ShouldEqual, 1.5)
|
|
So(points[3][0].Float64, ShouldEqual, 1.5)
|
|
|
})
|
|
})
|
|
|
|
|
+
|
|
|
|
|
+ Convey("When doing a metric query using timeGroup with last fill enabled", func() {
|
|
|
|
|
+ query := &tsdb.TsdbQuery{
|
|
|
|
|
+ Queries: []*tsdb.Query{
|
|
|
|
|
+ {
|
|
|
|
|
+ Model: simplejson.NewFromAny(map[string]interface{}{
|
|
|
|
|
+ "rawSql": "SELECT $__timeGroup(time, '5m', last) as time_sec, avg(value) as value FROM metric GROUP BY 1 ORDER BY 1",
|
|
|
|
|
+ "format": "time_series",
|
|
|
|
|
+ }),
|
|
|
|
|
+ RefId: "A",
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ TimeRange: &tsdb.TimeRange{
|
|
|
|
|
+ From: fmt.Sprintf("%v", fromStart.Unix()*1000),
|
|
|
|
|
+ To: fmt.Sprintf("%v", fromStart.Add(34*time.Minute).Unix()*1000),
|
|
|
|
|
+ },
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ resp, err := endpoint.Query(nil, nil, query)
|
|
|
|
|
+ So(err, ShouldBeNil)
|
|
|
|
|
+ queryResult := resp.Results["A"]
|
|
|
|
|
+ So(queryResult.Error, ShouldBeNil)
|
|
|
|
|
+
|
|
|
|
|
+ points := queryResult.Series[0].Points
|
|
|
|
|
+ So(points[2][0].Float64, ShouldEqual, 15.0)
|
|
|
|
|
+ So(points[3][0].Float64, ShouldEqual, 15.0)
|
|
|
|
|
+ So(points[6][0].Float64, ShouldEqual, 20.0)
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
Convey("Given a table with metrics having multiple values and measurements", func() {
|
|
Convey("Given a table with metrics having multiple values and measurements", func() {
|