Commit c7febca4 by bergquist

mqe: fixes broken test for indexalias

parent aa7292fa
...@@ -154,7 +154,8 @@ func (parser *ResponseParser) wildcardAlias(body MQEResponseSerie, queryToSend Q ...@@ -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) { ...@@ -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")
......
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