Skip to content
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

[query] Enable trace adjusters in api_v2 and api_v3 handlers #6423

Merged
merged 28 commits into from
Dec 29, 2024

Conversation

mahadzaryab1
Copy link
Collaborator

@mahadzaryab1 mahadzaryab1 commented Dec 27, 2024

Which problem is this PR solving?

Description of the changes

  • 🛑 This PR contains a breaking change for the api_v2 handler.
    • All GetTrace and FindTraces requests will apply these adjusters/enrichments on the trace by default.
    • In order to disable the adjusters for the FindTraces request, set the raw_traces flag in the query parameters to true.
    • In order to disable the adjusters for the GetTrace request, set the raw_traces flag in the request to true.
  • 🛑 This PR contains a breaking change for the api_v3 handler.
    • All GetTrace and FindTraces requests will apply these adjusters/enrichments on the trace by default.
    • In order to disable the adjusters for the FindTraces request, set the raw_traces flag in the query parameters to true.
    • In order to disable the adjusters for the GetTrace request, set the raw_traces flag in the request to true.

How was this change tested?

  • Added unit tests

Checklist

@mahadzaryab1 mahadzaryab1 added the changelog:breaking-change Change that is breaking public APIs or established behavior label Dec 27, 2024
Signed-off-by: Mahad Zaryab <[email protected]>
Copy link

codecov bot commented Dec 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.26%. Comparing base (a6616fb) to head (8c7124e).
Report is 1 commits behind head on main.

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     
Flag Coverage Δ
badger_v1 10.55% <0.00%> (-0.02%) ⬇️
badger_v2 2.59% <0.00%> (+0.16%) ⬆️
cassandra-4.x-v1-manual 16.43% <0.00%> (-0.03%) ⬇️
cassandra-4.x-v2-auto 2.52% <0.00%> (+0.16%) ⬆️
cassandra-4.x-v2-manual 2.52% <0.00%> (+0.16%) ⬆️
cassandra-5.x-v1-manual 16.43% <0.00%> (-0.03%) ⬇️
cassandra-5.x-v2-auto 2.52% <0.00%> (+0.16%) ⬆️
cassandra-5.x-v2-manual 2.52% <0.00%> (+0.16%) ⬆️
elasticsearch-6.x-v1 20.17% <0.00%> (-0.03%) ⬇️
elasticsearch-7.x-v1 20.25% <0.00%> (-0.03%) ⬇️
elasticsearch-8.x-v1 20.41% <0.00%> (-0.03%) ⬇️
elasticsearch-8.x-v2 2.58% <0.00%> (+0.16%) ⬆️
grpc_v1 12.21% <0.00%> (-0.02%) ⬇️
grpc_v2 8.98% <0.00%> (+0.16%) ⬆️
kafka-3.x-v1 10.39% <0.00%> (-0.02%) ⬇️
kafka-3.x-v2 2.59% <0.00%> (+0.16%) ⬆️
memory_v2 2.59% <0.00%> (+0.17%) ⬆️
opensearch-1.x-v1 20.29% <0.00%> (-0.03%) ⬇️
opensearch-2.x-v1 20.28% <0.00%> (-0.04%) ⬇️
opensearch-2.x-v2 2.58% <0.00%> (+0.16%) ⬆️
tailsampling-processor 0.39% <0.00%> (-0.01%) ⬇️
unittests 95.12% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

aH.writeJSON(w, r, structuredRes)
}

func shouldAdjust(r *http.Request) bool {
func shouldUseRawTraces(r *http.Request) bool {
raw := r.FormValue("raw")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to add tests with/without this arg. Also, since it's optional, should you be calling ParseBool unconditionally on it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yurishkuro This was the existing behaviour. It looks like we ignored anything that wasn't true. Do we want to change that here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I would make it more strict.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want the api to return an error here if the parameter isn't explicitly true or false?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

cmd/query/app/http_handler.go Outdated Show resolved Hide resolved
cmd/query/app/query_parser.go Outdated Show resolved Hide resolved
cmd/query/app/querysvc/query_service.go Outdated Show resolved Hide resolved
cmd/query/app/querysvc/query_service.go Outdated Show resolved Hide resolved
storage/spanstore/interface.go Outdated Show resolved Hide resolved
Signed-off-by: Mahad Zaryab <[email protected]>
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",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's better to have a field raw bool in the testCase

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]>
Signed-off-by: Mahad Zaryab <[email protected]>
@mahadzaryab1 mahadzaryab1 changed the title [WIP][query] Enable usage of adjusters in api_v2 and api_v3 handlers [query] Enable usage of adjusters in api_v2 and api_v3 handlers Dec 29, 2024
@mahadzaryab1 mahadzaryab1 marked this pull request as ready for review December 29, 2024 16:33
@mahadzaryab1 mahadzaryab1 requested a review from a team as a code owner December 29, 2024 16:33
@yurishkuro yurishkuro changed the title [query] Enable usage of adjusters in api_v2 and api_v3 handlers [query] Enable trace adjusters in api_v2 and api_v3 handlers Dec 29, 2024
@yurishkuro yurishkuro merged commit 7117fa8 into jaegertracing:main Dec 29, 2024
55 checks passed
@mahadzaryab1 mahadzaryab1 deleted the query-service-adjust branch December 29, 2024 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:breaking-change Change that is breaking public APIs or established behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable usage of adjusters in api_v2 and api_v3 handlers
2 participants