-
Notifications
You must be signed in to change notification settings - Fork 11.7k
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
Loki: Fix filters not being added with multiple expressions and parsers #75152
Conversation
@@ -574,9 +588,19 @@ function getAllPositionsInNodeByType(query: string, node: SyntaxNode, type: numb | |||
let pos = 0; | |||
let child = node.childAfter(pos); | |||
while (child) { | |||
positions.push(...getAllPositionsInNodeByType(query, child, type)); | |||
positions.push(...getAllPositionsInNodeByType(child, type)); | |||
pos = child.to; | |||
child = node.childAfter(pos); | |||
} | |||
return positions; | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All those changes above are basically just chores. Let me know if I should remove them.
Backend code coverage report for PR #75152 |
Frontend code coverage report for PR #75152
|
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new branch
git switch --create backport-75152-to-v10.1.x origin/v10.1.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x 480aa1ccca03f267907c685a0f2358a9793ff677
# When the conflicts are resolved, stage and commit the changes
git add . && git cherry-pick --continue If you have the GitHub CLI installed: # Push the branch to GitHub:
git push --set-upstream origin backport-75152-to-v10.1.x
# Create the PR body template
PR_BODY=$(gh pr view 75152 --json body --template 'Backport 480aa1ccca03f267907c685a0f2358a9793ff677 from #75152{{ "\n\n---\n\n" }}{{ index . "body" }}')
# Create the PR on GitHub
echo "${PR_BODY}" | gh pr create --title "[v10.1.x] Loki: Fix filters not being added with multiple expressions and parsers" --body-file - --label "type/bug" --label "area/frontend" --label "datasource/Loki" --label "add to changelog" --label "backport" --base v10.1.x --milestone 10.1.x --web Or, if you don't have the GitHub CLI installed (we recommend you install it!): # Push the branch to GitHub:
git push --set-upstream origin backport-75152-to-v10.1.x
# Create a pull request where the `base` branch is `v10.1.x` and the `compare`/`head` branch is `backport-75152-to-v10.1.x`.
# Remove the local backport branch
git switch main
git branch -D backport-75152-to-v10.1.x |
…rs (#75152) * determine last positions per expr * fix lint
What is this feature?
When using a dashboard with adhoc filters and a loki query containing two metric queries and label filters, the ad hoc filter is only added to the last label filter. Previously we determined the last positions of parsers or label filters in the whole query, however we need to do that per sub expression.
Which issue(s) does this PR fix?:
Fixes #75101
How do we reproduce it?
sum(rate({place="luna"} | logfmt [$__auto])) / sum(rate({place="moon"} |json [$__auto]))
query.