Skip to content

Commit

Permalink
Merge pull request #4 from kebe7jun/fix/remove-useless-where
Browse files Browse the repository at this point in the history
> remove useless where.
  • Loading branch information
kebe7jun authored Nov 18, 2019
2 parents 29bff76 + ca0db3d commit 9d5e4fd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion storage/spl_engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func MakeSPL(query *prompb.Query, c RemoteClient, index string) (string, error)
CommonMetricValue, index, metricName, step, ls)
for _, m := range query.Matchers {
if m.Name == "__name__" {
m.Name = "metric_name"
continue
}
switch m.Type {
case prompb.LabelMatcher_RE:
Expand Down
8 changes: 4 additions & 4 deletions storage/spl_engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestMakeSPL(t *testing.T) {
labels: []string{"test"},
},
"test",
`| mstats latest(_value) as ropee_metric_value where index=test AND metric_name=test span=10s by metric_name test| where metric_name="test"| rename metric_name as ropee_metric_name`,
`| mstats latest(_value) as ropee_metric_value where index=test AND metric_name=test span=10s by metric_name test| rename metric_name as ropee_metric_name`,
nil,
},
{
Expand All @@ -68,7 +68,7 @@ func TestMakeSPL(t *testing.T) {
labels: []string{"test"},
},
"test",
`| mstats latest(_value) as ropee_metric_value where index=test AND metric_name=test span=100s by metric_name test| where metric_name="test"| rename metric_name as ropee_metric_name`,
`| mstats latest(_value) as ropee_metric_value where index=test AND metric_name=test span=100s by metric_name test| rename metric_name as ropee_metric_name`,
nil,
},
{
Expand All @@ -91,7 +91,7 @@ func TestMakeSPL(t *testing.T) {
labels: []string{"test", "q"},
},
"test",
`| mstats latest(_value) as ropee_metric_value where index=test AND metric_name=test span=10s by metric_name test q| where metric_name="test"| rename metric_name as ropee_metric_name`,
`| mstats latest(_value) as ropee_metric_value where index=test AND metric_name=test span=10s by metric_name test q| rename metric_name as ropee_metric_name`,
nil,
},
{
Expand Down Expand Up @@ -129,7 +129,7 @@ func TestMakeSPL(t *testing.T) {
labels: []string{"test1", "test2", "test3"},
},
"test",
`| mstats latest(_value) as ropee_metric_value where index=test AND metric_name=test span=10s by metric_name test1 test2 test3| where metric_name="test"| where test1!="test"| regex test2=".*test$"| regex test3!=".*test$"| rename metric_name as ropee_metric_name`,
`| mstats latest(_value) as ropee_metric_value where index=test AND metric_name=test span=10s by metric_name test1 test2 test3| where test1!="test"| regex test2=".*test$"| regex test3!=".*test$"| rename metric_name as ropee_metric_name`,
nil,
},
{
Expand Down

0 comments on commit 9d5e4fd

Please sign in to comment.