feat(apiv3): support query.attributes[key]=value filter in GET /api/v3/traces#8582
Closed
Pulkit7070 wants to merge 1 commit into
Closed
feat(apiv3): support query.attributes[key]=value filter in GET /api/v3/traces#8582Pulkit7070 wants to merge 1 commit into
Pulkit7070 wants to merge 1 commit into
Conversation
…i/v3/traces The HTTP gateway's FindTraces handler initialized an empty Attributes map but never populated it from query parameters; the grpc-gateway encoding for proto map<string,string> fields is not supported by the upstream gateway. Clients can now filter traces by span attributes via bracket-notation query params, e.g. ?query.attributes[http.method]=GET matching the same field that the gRPC FindTracesRequest already accepts. Signed-off-by: Pulkit Saraf <prateeksaraf9@gmail.com>
Contributor
Author
|
Gentle ping - happy to address any feedback when you get a chance. |
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.
Which problem is this PR solving?
Closes #7594
Grafana and other clients that rely on
GET /api/v3/tracesfor trace search have no way to filter by span attributes (tags). The gRPCFindTracesRequestalready accepts amap<string,string> attributesfield, but the HTTP gateway silently ignored it because the standard grpc-gateway encoding for proto map fields is unsupported by the gateway middleware.Description of the changes
http_gateway.goparamAttributesPrefix = "query.attributes["constant.parseFindTracesQuery, scan all query parameters for the bracket-notation patternquery.attributes[<key>]=<value>and populatetracestore.TraceQueryParams.Attributesaccordingly.stringsfor the prefix/suffix check.Clients can now pass one or more attribute filters as URL query params:
http_gateway_test.goTestHTTPGatewayFindTracesAttributesthat sends two attribute filters and verifies the underlyingFindTracescall receives the correctpcommon.Map.How was this change tested?
All new and existing tests pass. Pre-existing snapshot failures on Windows (CRLF/LF) are unrelated.