[refactor][query] Propagate RawTraces flag to query service#6438
[refactor][query] Propagate RawTraces flag to query service#6438yurishkuro merged 17 commits intojaegertracing:mainfrom
RawTraces flag to query service#6438Conversation
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
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 <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
GetTraceParameters and TraceQueryParameters in query serviceRawTraces flag to query service
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
| { | ||
| name: "TestGetTraceWithInvalidRawTraces", | ||
| requestUrl: "/api/v3/traces/123?query.raw_traces=foobar", | ||
| expectedError: "malformed parameter query.raw_traces", |
There was a problem hiding this comment.
curious - why above error messages did not include query. prefix for param name?
There was a problem hiding this comment.
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.
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.
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.
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.
@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.
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.
do we want to address this in a future PR?
There was a problem hiding this comment.
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 <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
|
|
||
| // 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.
should this remain spanstore.GetTraceParameters? Or ArchiveTraceParameters, but Get with raw doesn't apply here.
There was a problem hiding this comment.
@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 <mahadzaryab1@gmail.com>
|
@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
GetTraceParamatersandTraceQueryParametersinsidepackage querysvcthat are currently just wrappers around theirpackage spanstorecounterparts.RawTracesflag, without having to extend the parameters that are passed into the storage implementations.How was this change tested?
Checklist
jaeger:make lint testjaeger-ui:npm run lintandnpm run test