grafana / lezer-logql

LogQL lezer grammar
Apache License 2.0
3 stars 4 forks source link

Grammar: Add `DurationVariable` #15

Closed svennergr closed 2 years ago

svennergr commented 2 years ago

As shown in this issue https://github.com/grafana/grafana/issues/54448 we are facing problems when parsing queries with errors. With the lezer-common update, lezer will not stop parsing until a known element is found or the end of the string.

When parsing an empty stream selector {} followed by an unknown duration [$__interval] this resulted in unwanted behavior - e.g. when adding ad-hoc queries.

To overcome this for now, I added $__interval and $__interval_ms as known elements to the parser named as DurationVariable.

svennergr commented 2 years ago

Looks good.

Cool - let us discuss in tomorrow's standup if we wait for @ivanahuckova / @gabor or not.

ivanahuckova commented 2 years ago

I am worried here a little, because we are tying/inter-connecting grafana's variables with logql grammar. I would rather try to solve this in grafana repo as this is open source package that can possibly be used in other projects where this can potentially create issues.