-
Notifications
You must be signed in to change notification settings - Fork 510
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
[Tag value search] Support q
query param in /api/v2/search/<tag.name>/values
#2253
Conversation
q
query param in /api/v2/search/<tag.name>/values
Do we need to add docs for this? |
Yes. I will update the API docs shortly 👍 |
pkg/traceql/engine.go
Outdated
// 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. |
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.
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.
pkg/traceql/engine.go
Outdated
} | ||
|
||
collectAttributeValue := func(s Span) bool { | ||
switch wantAttr.Scope { |
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.
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.
pkg/traceql/engine.go
Outdated
for _, ss := range evalSS { | ||
for _, s := range ss.Spans { | ||
if collectAttributeValue(s) { | ||
break evalLoop // Exit early if we have enough data |
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.
We can return io.EOF
to completely stop the Fetch.
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.
LGTM - Left a few comments, which we discussed offline.
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.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]