Skip to content

Commit

Permalink
> remove useless where.
Browse files Browse the repository at this point in the history
  • Loading branch information
kebe7jun committed Nov 18, 2019
1 parent c9d5fcb commit ca0db3d
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
@@ -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:
8 changes: 4 additions & 4 deletions storage/spl_engine_test.go
Original file line number Diff line number Diff line change
@@ -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,
},
{
@@ -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,
},
{
@@ -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,
},
{
@@ -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,
},
{

0 comments on commit ca0db3d

Please sign in to comment.