Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grammar: Add DurationVariable #15

Merged
merged 1 commit into from
Aug 31, 2022
Merged

Conversation

svennergr
Copy link
Contributor

As shown in this issue grafana/grafana#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 svennergr self-assigned this Aug 30, 2022
Copy link
Contributor

@matyax matyax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

src/logql.grammar Show resolved Hide resolved
@svennergr
Copy link
Contributor Author

Looks good.

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

@svennergr svennergr merged commit 0ba8bec into main Aug 31, 2022
@ivanahuckova
Copy link
Member

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.

svennergr added a commit that referenced this pull request Sep 5, 2022
svennergr added a commit that referenced this pull request Sep 5, 2022
* Revert "Grammar: Add `DurationVariable` (#15)"

This reverts commit 0ba8bec.

* Update package.json

* Update package-lock.json

* Update tree-viz.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants