[Tag value search] Support q query param in /api/v2/search/<tag.name>/values#2253
Merged
mapno merged 44 commits intografana:mainfrom Apr 24, 2023
Merged
[Tag value search] Support q query param in /api/v2/search/<tag.name>/values#2253mapno merged 44 commits intografana:mainfrom
q query param in /api/v2/search/<tag.name>/values#2253mapno merged 44 commits intografana:mainfrom
Conversation
q query param in /api/v2/search/<tag.name>/values
Contributor
|
Do we need to add docs for this? |
Contributor
Author
Yes. I will update the API docs shortly 👍 |
mdisibio
reviewed
Mar 29, 2023
joe-elliott
reviewed
Mar 29, 2023
mdisibio
reviewed
Apr 21, 2023
| // TODO: Merge into a single regular expression | ||
|
|
||
| // Regex to extract selectors from a query string | ||
| // This regular expression matches a string that contains a single selector and no OR `||` conditions. |
Contributor
There was a problem hiding this comment.
Let's change selector to spanset filter which matches the traceql definitions, and add a few examples of queries that match or don't match.
mdisibio
reviewed
Apr 21, 2023
| } | ||
|
|
||
| collectAttributeValue := func(s Span) bool { | ||
| switch wantAttr.Scope { |
Contributor
There was a problem hiding this comment.
Since wantAttr.Scope doesn't change, we should move this switch logic out of the loop, it can be done once before the Filter function.
mdisibio
reviewed
Apr 21, 2023
| for _, ss := range evalSS { | ||
| for _, s := range ss.Spans { | ||
| if collectAttributeValue(s) { | ||
| break evalLoop // Exit early if we have enough data |
Contributor
There was a problem hiding this comment.
We can return io.EOF to completely stop the Fetch.
mdisibio
approved these changes
Apr 21, 2023
Contributor
mdisibio
left a comment
There was a problem hiding this comment.
LGTM - Left a few comments, which we discussed offline.
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.
What this PR does:
Add support for passing a traceql query to tag values search, via query param
q. The query can be incomplete—eg.{ .cluster = "foo" && .namespace = }. In such cases, Tempo will extract the value matchers, ie.foo = "bar", and build a query that can be parse by the storage layer.This is done with a regex that captures the valid matchers. Below is a benchmark of this function for some queries. Overall, the cost of extracting the matchers is very low, and shouldn't affect latency.
Which issue(s) this PR fixes:
Contributes to #1868
Checklist
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX]