Closed davkal closed 4 years ago
This is actually tricky because the engine is calling {job="cortex-ops/ingester"} |= "error"
a log expression.
Not sure how we could refactor our yacc file.
@codesome you looked at this already what do you think ?
This is happening here:
https://github.com/grafana/loki/blob/master/pkg/logql/expr.y#L69
Looking at the above examples, {job="cortex-ops/ingester"}[5m]
looks more like a range selector (and better), {job="cortex-ops/ingester"} |= "error" [5m]
looks like a selector on a query.
I guess we cannot (or don't want to) get rid of the current approach as it will be a breaking change. I will take a look at the yacc file to see how it can be done, should be possible.
Got a way to do it, will open a PR tomorrow
This is more a syntax sugar, I’m not sure we want to advertise it too much, what’s the rationale @davkal ?
Because it feels more natural for Prometheus users
I'd like to write queries like
which produces a syntax error:
syntax error: unexpected |=, expecting )
Instead I have to write them like