[query] Enable trace adjusters in api_v2 and api_v3 handlers#6423
[query] Enable trace adjusters in api_v2 and api_v3 handlers#6423yurishkuro merged 28 commits intojaegertracing:mainfrom
Conversation
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>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6423 +/- ##
==========================================
+ Coverage 96.23% 96.26% +0.02%
==========================================
Files 368 368
Lines 21028 21032 +4
==========================================
+ Hits 20237 20246 +9
+ Misses 606 602 -4
+ 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. |
cmd/query/app/http_handler.go
Outdated
|
|
||
| func shouldAdjust(r *http.Request) bool { | ||
| func shouldUseRawTraces(r *http.Request) bool { | ||
| raw := r.FormValue("raw") |
There was a problem hiding this comment.
Need to add tests with/without this arg. Also, since it's optional, should you be calling ParseBool unconditionally on it?
There was a problem hiding this comment.
@yurishkuro This was the existing behaviour. It looks like we ignored anything that wasn't true. Do we want to change that here?
There was a problem hiding this comment.
yes, I would make it more strict.
There was a problem hiding this comment.
do we want the api to return an error here if the parameter isn't explicitly true or false?
There was a problem hiding this comment.
I think it's ok to be flexible similar to https://pkg.go.dev/strconv#ParseBool. I.e. t or 1 are fine, but fooobar should return an error.
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <43658574+mahadzaryab1@users.noreply.github.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
cmd/query/app/http_handler_test.go
Outdated
| ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), spanstore.GetTraceParameters{TraceID: model.NewTraceID(0, 0x123456abc)}). | ||
| ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), spanstore.GetTraceParameters{ | ||
| TraceID: model.NewTraceID(0, 0x123456abc), | ||
| RawTraces: testCase.suffix == "?raw=true", |
There was a problem hiding this comment.
it's better to have a field raw bool in the testCase
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <43658574+mahadzaryab1@users.noreply.github.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>
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>
…racing#6423) ## Which problem is this PR solving? - Resolves jaegertracing#6417 ## Description of the changes - 🛑 This PR contains a breaking change for the api_v2 handler. - All [GetTrace](https://github.com/jaegertracing/jaeger-idl/blob/main/proto/api_v2/query.proto#L37) and [FindTraces](https://github.com/jaegertracing/jaeger-idl/blob/main/proto/api_v2/query.proto#L125) requests will apply [these](https://github.com/jaegertracing/jaeger/blob/main/cmd/query/app/querysvc/adjusters.go#L17-L24) adjusters/enrichments on the trace by default. - In order to disable the adjusters for the `FindTraces` request, set the [raw_traces](https://github.com/jaegertracing/jaeger-idl/blob/main/proto/api_v2/query.proto#L122) flag in the query parameters to `true`. - In order to disable the adjusters for the `GetTrace` request, set the [raw_traces](https://github.com/jaegertracing/jaeger-idl/blob/main/proto/api_v2/query.proto#L56) flag in the request to `true`. - 🛑 This PR contains a breaking change for the api_v3 handler. - All [GetTrace](https://github.com/jaegertracing/jaeger-idl/blob/main/proto/api_v3/query_service.proto#L27) and [FindTraces](https://github.com/jaegertracing/jaeger-idl/blob/main/proto/api_v3/query_service.proto#L88) requests will apply [these](https://github.com/jaegertracing/jaeger/blob/main/cmd/query/app/querysvc/adjusters.go#L17-L24) adjusters/enrichments on the trace by default. - In order to disable the adjusters for the `FindTraces` request, set the [raw_traces](https://github.com/jaegertracing/jaeger-idl/blob/main/proto/api_v3/query_service.proto#L84) flag in the query parameters to `true`. - In order to disable the adjusters for the `GetTrace` request, set the [raw_traces](https://github.com/jaegertracing/jaeger-idl/blob/main/proto/api_v3/query_service.proto#L40) flag in the request to `true`. ## How was this change tested? - Added unit tests ## Checklist - [x] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md - [x] I have signed all commits - [x] I have added unit tests for the new functionality - [x] I have run lint and test steps successfully - for `jaeger`: `make lint test` - for `jaeger-ui`: `npm run lint` and `npm run test` --------- Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com> Signed-off-by: Mahad Zaryab <43658574+mahadzaryab1@users.noreply.github.com>
Which problem is this PR solving?
Description of the changes
FindTracesrequest, set the raw_traces flag in the query parameters totrue.GetTracerequest, set the raw_traces flag in the request totrue.FindTracesrequest, set the raw_traces flag in the query parameters totrue.GetTracerequest, set the raw_traces flag in the request totrue.How was this change tested?
Checklist
jaeger:make lint testjaeger-ui:npm run lintandnpm run test