-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[refactor][query] Propagate RawTraces
flag to query service
#6438
[refactor][query] Propagate RawTraces
flag to query service
#6438
Conversation
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6438 +/- ##
==========================================
+ Coverage 96.23% 96.26% +0.02%
==========================================
Files 368 368
Lines 20978 21028 +50
==========================================
+ Hits 20189 20242 +53
+ Misses 604 602 -2
+ Partials 185 184 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
GetTraceParameters
and TraceQueryParameters
in query serviceRawTraces
flag to query service
Signed-off-by: Mahad Zaryab <[email protected]>
{ | ||
name: "TestGetTraceWithInvalidRawTraces", | ||
requestUrl: "/api/v3/traces/123?query.raw_traces=foobar", | ||
expectedError: "malformed parameter query.raw_traces", |
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.
curious - why above error messages did not include query.
prefix for param name?
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.
Those parameters don't have the query
prefix - see https://github.com/jaegertracing/jaeger/blob/main/cmd/query/app/apiv3/http_gateway.go#L30-L32
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.
It's confusing to me why that's the case (this can be seen in the swagger file). But, regardless, according to swagger.json, when the url is traces/?...
it's interpreted as FindTraces
and all params have the query.
prefix, but if the url is traces/{traceID}?...
then it's the GetTrace
method and the params don't have the prefix. Meaning that the above example is an invalid 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.
Got it! Thanks for the explanation - I fixed this now to have two constants.
cmd/query/app/http_handler_test.go
Outdated
var response structuredResponse | ||
err := getJSON(ts.server.URL+`/api/traces/`+mockTraceID.String()+`?raw=true`, &response) | ||
require.NoError(t, err) | ||
assert.Empty(t, response.Errors) |
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.
the more accurate test would be to use a mock trace that has a known issue that adjusters would fix (e.g. same ID for client/server spans), run the query twice with raw=true|false, and observe the difference in the output.
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.
@yurishkuro Agreed. But this PR doesn't actually implement the differentiating logic but rather just passes the flag down. That will happen in #6423.
return false, true | ||
} | ||
|
||
func (aH *APIHandler) parseGetTraceParameters(w http.ResponseWriter, r *http.Request) (querysvc.GetTraceParameters, bool) { |
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.
Side note: this function is poorly designed. A better design is query_parser.parseTraceQueryParams
, which simply returns errors. The aH.handleError
should really be used only rarely, directly in the handler function.
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.
do we want to address this in a future PR?
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.
it's one of these nice to have clean-ups, I'd rather have it as good-first-issue for someone other than you spending time on it.
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
} | ||
|
||
// ArchiveTrace is the queryService utility to archive traces. | ||
func (qs QueryService) ArchiveTrace(ctx context.Context, query spanstore.GetTraceParameters) error { | ||
func (qs QueryService) ArchiveTrace(ctx context.Context, query GetTraceParameters) error { |
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.
should this remain spanstore.GetTraceParameters
? Or ArchiveTraceParameters, but Get with raw
doesn't apply here.
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.
@yurishkuro Thanks for catching. This was an oversight - I reverted it back for now. We can always create a separate type here if we need to in the future.
Signed-off-by: Mahad Zaryab <[email protected]>
@yurishkuro I think there are two lines that are missing code coverage at the moment in the |
Which problem is this PR solving?
Description of the changes
GetTraceParamaters
andTraceQueryParameters
insidepackage querysvc
that are currently just wrappers around theirpackage spanstore
counterparts.RawTraces
flag, without having to extend the parameters that are passed into the storage implementations.How was this change tested?
Checklist
jaeger
:make lint test
jaeger-ui
:npm run lint
andnpm run test