-
Notifications
You must be signed in to change notification settings - Fork 495
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
Fix autocomplete panic when condition has wrong type #3277
Conversation
@@ -358,6 +358,8 @@ func createDistinctAttributeIterator( | |||
} | |||
keyIter = makeIter(keyPath, parquetquery.NewStringInPredicate([]string{cond.Attribute.Name}), selectAs("key", cond.Attribute)) | |||
valIter = makeIter(boolPath, pred, selectAs("bool", cond.Attribute)) | |||
default: | |||
continue |
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.
Another option is returning an error, but instead opted for ignoring the condition.
The reasoning is that autocomplete should be a smooth experience to the user. If the filtering query has an error, they'll get that feedback via normal search—ie. when they execute the query.
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.
are we missing case statements for things like kind = server
and status = ok
?
it seems like we should support auto complete on things like:
{ name = "foo" && kind = server && status = error && span.foo = ...
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.
That function builds the iterators for the generic attribute columns which don't support those special types.
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.
thx for the clarification.
agree with your initial thought we should just ignore the bad condition over returning an error.
@@ -358,6 +358,8 @@ func createDistinctAttributeIterator( | |||
} | |||
keyIter = makeIter(keyPath, parquetquery.NewStringInPredicate([]string{cond.Attribute.Name}), selectAs("key", cond.Attribute)) | |||
valIter = makeIter(boolPath, pred, selectAs("bool", cond.Attribute)) | |||
default: | |||
continue |
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.
are we missing case statements for things like kind = server
and status = ok
?
it seems like we should support auto complete on things like:
{ name = "foo" && kind = server && status = error && span.foo = ...
Co-authored-by: Joe Elliott <joe.elliott@grafana.com>
Hello @mapno!
Please, if the current pull request addresses a bug fix, label it with the |
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-3277-to-release-v2.3 origin/release-v2.3
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x b61b12acd8844f37f7fee1d6ad15d1acf410755e When the conflicts are resolved, stage and commit the changes:
If you have the GitHub CLI installed: # Push the branch to GitHub:
git push --set-upstream origin backport-3277-to-release-v2.3
# Create the PR body template
PR_BODY=$(gh pr view 3277 --json body --template 'Backport b61b12acd8844f37f7fee1d6ad15d1acf410755e from #3277{{ "\n\n---\n\n" }}{{ index . "body" }}')
# Create the PR on GitHub
echo "${PR_BODY}" | gh pr create --title "[release-v2.3] Fix autocomplete panic when condition has wrong type" --body-file - --label "type/bug" --label "area/query" --label "backport" --base release-v2.3 --milestone release-v2.3 --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-3277-to-release-v2.3
# Create a pull request where the `base` branch is `release-v2.3` and the `compare`/`head` branch is `backport-3277-to-release-v2.3`.
# Remove the local backport branch
git switch main
git branch -D backport-3277-to-release-v2.3 |
The autocomplete changes weren't released in v2.3. Nothing to backport! 😅 |
* Fix autocomplete panic when condition has wrong type * Add comment * Update CHANGELOG.md Co-authored-by: Joe Elliott <joe.elliott@grafana.com> --------- Co-authored-by: Joe Elliott <joe.elliott@grafana.com> (cherry picked from commit b61b12a)
* Fix autocomplete panic when condition has wrong type * Add comment * Update CHANGELOG.md Co-authored-by: Joe Elliott <joe.elliott@grafana.com> --------- Co-authored-by: Joe Elliott <joe.elliott@grafana.com> (cherry picked from commit b61b12a)
What this PR does:
It prevents a panic when a filtering query is passed to
/search/tag/<tag>/values
with a attribute condition (.a=b
) whereb
is a special type (server/client
,ok/error/unset
) but.a
is of a different type (string
,int
). For example,span.http.status_code=server
. This would create iterators with nil predicates and panics when it callediter.Next()
.Now, such conditions are ignored and iterators are not built for them.
Which issue(s) this PR fixes:
Fixes #
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]