Commit 87650c15 by bergquist

feat(influxdb): add tags to serie names

parent b0addbd7
......@@ -45,7 +45,17 @@ func (rp *ResponseParser) parseResult(result []Row, queryResult *tsdb.QueryResul
}
func (rp *ResponseParser) formatName(row Row, column string) string {
return fmt.Sprintf("%s.%s", row.Name, column)
tags := ""
for k, v := range row.Tags {
tags += k + ": " + v
}
if tags != "" {
tags = fmt.Sprintf(" { %s }", tags)
}
return fmt.Sprintf("%s.%s%s", row.Name, column, tags)
}
func (rp *ResponseParser) parseTimepoint(k []interface{}, valuePosition int) tsdb.TimePoint {
......
......@@ -52,8 +52,8 @@ func TestInfluxdbResponseParser(t *testing.T) {
})
Convey("can format serie names", func() {
So(result.Series[0].Name, ShouldEqual, "cpu.mean")
So(result.Series[1].Name, ShouldEqual, "cpu.sum")
So(result.Series[0].Name, ShouldEqual, "cpu.mean { datacenter: America }")
So(result.Series[1].Name, ShouldEqual, "cpu.sum { datacenter: America }")
})
})
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment