-
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
Dynamic metrics group by multiple attributes #2582
Dynamic metrics group by multiple attributes #2582
Conversation
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.
This looks like a good start to me. Do you want to plumb through the frontend, or leave that for another PR?
Can you clarify what you mean? It already works end-to-end by reusing the Note I chose comma because it's a common delimiter, and it's already excluded from being part of an attribute name in regular queries by the code here: https://github.com/grafana/tempo/blob/main/pkg/traceql/lexer.go#L253 |
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.
Sorry, I meant to approve yesterday. This looks good to me with one comment about whitespace on the query.
return results, nil | ||
} | ||
|
||
func lookup(needles []traceql.Attribute, haystack map[traceql.Attribute]traceql.Static) traceql.Static { |
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.
Haha, I love this signature.
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.
Yeah it was feeling clunky but I think those parameter names saved it. :)
message SpanMetrics { | ||
repeated RawHistogram latency_histogram = 1; | ||
TraceQLStatic static = 2; | ||
repeated KeyValue series = 2; |
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.
Maybe we also include a status code to indicate control messages like not-found?
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.
Or possibly on the KeyValue
.
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.
When an attribute is not found it will return a traceql static with Nil type (empty value). This works because real nils are not possible (against spec but also not persisted).
What this PR does:
Updated /api/metrics/summary to support grouping by mulitple attributes. The
groupBy
parameter can be a comma delimited list of attributes. Response was changed to return a slice of key/value pairs, in the same order that they are specified in groupBy. A nil is returned for any missing value. Originally it was just the values, but I thought it was better to include the key instead of putting the onus on the caller to know what to expect.This is a draft because it should go after #2579 which also has changes in this area.
Which issue(s) this PR fixes:
Fixes n.a
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]