mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
InfluxDB: Fix tag names with periods in alerting (#16255)
Updates regex to match tag names with periods when generating series names in alerting evaluation (backend). Fixes #9148
This commit is contained in:
committed by
Marcus Efraimsson
parent
00a07c855d
commit
33d1d427bc
@@ -18,7 +18,7 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
legendFormat = regexp.MustCompile(`\[\[(\w+?)*\]\]*|\$\s*(\w+?)*`)
|
||||
legendFormat = regexp.MustCompile(`\[\[(\w+)(\.\w+)*\]\]*|\$\s*(\w+?)*`)
|
||||
}
|
||||
|
||||
func (rp *ResponseParser) Parse(response *Response, query *Query) *tsdb.QueryResult {
|
||||
|
@@ -75,7 +75,10 @@ func TestInfluxdbResponseParser(t *testing.T) {
|
||||
{
|
||||
Name: "cpu.upc",
|
||||
Columns: []string{"time", "mean", "sum"},
|
||||
Tags: map[string]string{"datacenter": "America"},
|
||||
Tags: map[string]string{
|
||||
"datacenter": "America",
|
||||
"dc.region.name": "Northeast",
|
||||
},
|
||||
Values: [][]interface{}{
|
||||
{json.Number("111"), json.Number("222"), json.Number("333")},
|
||||
},
|
||||
@@ -159,6 +162,13 @@ func TestInfluxdbResponseParser(t *testing.T) {
|
||||
|
||||
So(result.Series[0].Name, ShouldEqual, "alias America")
|
||||
})
|
||||
|
||||
Convey("tag alias with periods", func() {
|
||||
query := &Query{Alias: "alias [[tag_dc.region.name]]"}
|
||||
result := parser.Parse(response, query)
|
||||
|
||||
So(result.Series[0].Name, ShouldEqual, "alias Northeast")
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user