mirror of
https://github.com/grafana/grafana.git
synced 2025-02-04 12:41:12 -06:00
mqe: fixes broken test for indexalias
This commit is contained in:
parent
aa7292fac6
commit
c7febca447
@ -154,7 +154,8 @@ func (parser *ResponseParser) wildcardAlias(body MQEResponseSerie, queryToSend Q
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (parser *ResponseParser) indexAlias(body MQEResponseSerie, queryToSend QueryToSend) string {
|
func (parser *ResponseParser) indexAlias(body MQEResponseSerie, queryToSend QueryToSend) string {
|
||||||
queryNameParts := strings.Split(body.Name, `.`)
|
queryNameParts := strings.Split(queryToSend.Metric.Metric, `.`)
|
||||||
|
|
||||||
name := indexAliasPattern.ReplaceAllStringFunc(queryToSend.Metric.Alias, func(in string) string {
|
name := indexAliasPattern.ReplaceAllStringFunc(queryToSend.Metric.Alias, func(in string) string {
|
||||||
positionName := strings.TrimSpace(strings.Replace(in, "$", "", 1))
|
positionName := strings.TrimSpace(strings.Replace(in, "$", "", 1))
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ func TestMQEResponseParser(t *testing.T) {
|
|||||||
AddClusterToAlias: true,
|
AddClusterToAlias: true,
|
||||||
AddHostToAlias: true,
|
AddHostToAlias: true,
|
||||||
},
|
},
|
||||||
Metric: Metric{Alias: "$2 $3"},
|
Metric: Metric{Alias: "$2 $3", Metric: "os.disk.sda3.weighted_io_time"},
|
||||||
}
|
}
|
||||||
legend := parser.formatLegend(serie, mqeSerie, queryRef)
|
legend := parser.formatLegend(serie, mqeSerie, queryRef)
|
||||||
So(legend, ShouldEqual, "demoapp staples-lab-1 disk.sda3")
|
So(legend, ShouldEqual, "demoapp staples-lab-1 disk.sda3")
|
||||||
|
Loading…
Reference in New Issue
Block a user