Repository navigation
[ENHANCEMENT] Loki: upgrade @grafana/lezer-logql to 0.4.2 - #932
Merged
Merged
Conversation
The Loki query editor now parses the approx_topk and approx_count_distinct aggregations instead of reporting syntax errors for these valid queries. The Loki and VictoriaLogs plugins now share a single version of the parser. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Augustin Husson <augustin.husson@amadeus.com>
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Follow-up of #904, which upgraded
@grafana/lezer-logqlto 0.4.2 for the VictoriaLogs plugin only. This PR upgrades theLoki plugin to the same version.
loki/package.json:@grafana/lezer-logql^0.2.8→^0.4.2. It was the only outdated dependency of the plugin(
react-compiler-runtimeis already at its latest version, 1.0.0).package-lock.json: the root copy moves from 0.2.9 to 0.4.2 and the nested copy that [Snyk] Upgrade @grafana/lezer-logql from 0.2.9 to 0.4.2 #904 installed for VictoriaLogsis removed, so both plugins share a single version of the parser.
loki/src/components/logql-extension.test.ts(new): checks that the editor's LogQL language parses the approximateaggregations without syntax errors. The two
approx_*cases fail with 0.2.9 and pass with 0.4.2.User-visible change: with 0.2.9, the Loki query editor parsed valid queries using
approx_topk(added in 0.4.1)or
approx_count_distinct(added in 0.4.2) into error nodes, which the highlighter styles as invalid. They now parsecorrectly. Otherwise the grammar change is additive (4 new node types, none removed); on a sample of existing LogQL
queries, the syntax trees are identical between both versions, and label name/value and pipe completions keep working,
including inside the new functions.
Compatibility notes:
complete.tsimports them by name from the package, and@grafana/lezer-logql/@lezer/*are bundled with the plugin (not shared through module federation), so the parserand the IDs always come from the same copy.
@lezer/lrpeer dependency to exactly1.4.10, which is already the version in thelockfile (still a single copy).
formatLokiQueryexport, which is not used in this repository.Validation (Node v24.19.0 from
.nvmrc, npm 11.17.0 frompackageManager):npm ci: passednpm run lint: passed (no new warnings)npm run format:check: passednpm run type-check: passednpm run test: passed (Loki: 97 tests)npm install --no-save react@^19 react-dom@^19 @types/react@^19 @types/react-dom@^19, thennpm run type-checkandnpm run test: passedpercli plugin build --plugin.path=loki --skip.npm-install=true: passedpercli plugin build --plugin.path=victorialogs --skip.npm-install=true: passedScreenshots
No component changes. The only visible effect is that queries using
approx_topkorapprox_count_distinctare nolonger highlighted as invalid in the Loki query editor.
Checklist
[<catalog_entry>] <commit message>naming convention using one of thefollowing
catalog_entryvalues:FEATURE,ENHANCEMENT,BUGFIX,BREAKINGCHANGE,DOC,IGNORE.UI Changes