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

Add optional time window for GetTrace & SearchTrace of http_handler #6159

Conversation

rim99
Copy link
Contributor

@rim99 rim99 commented Nov 4, 2024

Which problem is this PR solving?

Resolves #4150

Description of the changes

  • add optional time window when fetching trace by id

How was this change tested?

  • unittest

Checklist

@rim99 rim99 force-pushed the optinal-time-window-when-fetching-trace-by-id branch 3 times, most recently from cb5f24f to d00b4d3 Compare November 4, 2024 13:57
@rim99 rim99 marked this pull request as ready for review November 4, 2024 14:07
@rim99 rim99 requested a review from a team as a code owner November 4, 2024 14:07
@rim99 rim99 requested a review from jkowall November 4, 2024 14:07
@rim99 rim99 changed the title Add optinal time window in TraceGetParameters Add optional time window in TraceGetParameters Nov 4, 2024
@rim99 rim99 force-pushed the optinal-time-window-when-fetching-trace-by-id branch from a0bb411 to 74fd1e5 Compare November 10, 2024 11:55
@yurishkuro
Copy link
Member

please rebase

@rim99 rim99 force-pushed the optinal-time-window-when-fetching-trace-by-id branch 2 times, most recently from 7c3ab0c to 3d939f2 Compare November 21, 2024 14:50
@rim99
Copy link
Contributor Author

rim99 commented Nov 21, 2024

@yurishkuro Updated bsaed on comments, please reivew this PR, thanks

Makefile.Protobuf.mk Outdated Show resolved Hide resolved
@yurishkuro
Copy link
Member

yurishkuro commented Nov 21, 2024

@rim99 this PR is too large, please break it into logical pieces. At minimum grpc storage changes could be a separate PR, e.g. changing the IDL. The anonymizer change can be separate.

@yurishkuro
Copy link
Member

you have jaeger-ui submodule change, it's not related

@rim99
Copy link
Contributor Author

rim99 commented Nov 23, 2024

@rim99 this PR is too large, please break it into logical pieces. At minimum grpc storage changes could be a separate PR, e.g. changing the IDL. The anonymizer change can be separate.

Cool, I'll keep creating new PRs and rebasing until we're satisfied with the size of this PR.

And first PR is: #6242 . Other changes rely on this

Signed-off-by: Zhang Xin <zhangxin@outlook.com>
@rim99 rim99 force-pushed the optinal-time-window-when-fetching-trace-by-id branch from 295a9f3 to a35d464 Compare December 19, 2024 13:21
@rim99 rim99 changed the title Add optional time window in TraceGetParameters Add optional time window for GetTrace & SearchTrace of http_handler Dec 19, 2024
@rim99
Copy link
Contributor Author

rim99 commented Dec 19, 2024

@yurishkuro Now this PR contains changes of http_handler only, please review

Copy link

codecov bot commented Dec 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.21%. Comparing base (86f2305) to head (3ba412f).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6159      +/-   ##
==========================================
- Coverage   96.22%   96.21%   -0.01%     
==========================================
  Files         361      362       +1     
  Lines       20621    20705      +84     
==========================================
+ Hits        19843    19922      +79     
- Misses        595      599       +4     
- Partials      183      184       +1     
Flag Coverage Δ
badger_v1 9.04% <ø> (-0.01%) ⬇️
badger_v2 1.64% <ø> (-0.01%) ⬇️
cassandra-4.x-v1-manual 15.04% <ø> (+0.02%) ⬆️
cassandra-4.x-v2-auto 1.58% <ø> (-0.01%) ⬇️
cassandra-4.x-v2-manual 1.58% <ø> (-0.01%) ⬇️
cassandra-5.x-v1-manual 15.04% <ø> (+0.02%) ⬆️
cassandra-5.x-v2-auto 1.58% <ø> (-0.01%) ⬇️
cassandra-5.x-v2-manual 1.58% <ø> (-0.01%) ⬇️
elasticsearch-6.x-v1 18.76% <ø> (-0.02%) ⬇️
elasticsearch-7.x-v1 18.83% <ø> (-0.03%) ⬇️
elasticsearch-8.x-v1 19.00% <ø> (-0.02%) ⬇️
elasticsearch-8.x-v2 1.63% <ø> (-0.01%) ⬇️
grpc_v1 10.72% <ø> (+0.03%) ⬆️
grpc_v2 7.98% <ø> (+0.03%) ⬆️
kafka-v1 9.40% <ø> (+0.03%) ⬆️
kafka-v2 1.64% <ø> (-0.01%) ⬇️
memory_v2 1.64% <ø> (+<0.01%) ⬆️
opensearch-1.x-v1 18.88% <ø> (-0.03%) ⬇️
opensearch-2.x-v1 18.89% <ø> (-0.01%) ⬇️
opensearch-2.x-v2 1.64% <ø> (-0.01%) ⬇️
tailsampling-processor 0.47% <ø> (-0.01%) ⬇️
unittests 95.06% <100.00%> (-0.01%) ⬇️

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.

Signed-off-by: Zhang Xin <zhangxin@outlook.com>
@rim99 rim99 force-pushed the optinal-time-window-when-fetching-trace-by-id branch from 55ea627 to d8fc5f9 Compare December 20, 2024 14:13
Signed-off-by: Zhang Xin <zhangxin@outlook.com>
TraceID: traceID,
TraceID: traceID,
StartTime: startTime,
EndTime: endTime,
Copy link
Member

Choose a reason for hiding this comment

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

from the start of the function up to this point it's the same code as in getTrace. Please move it to parseGetTraceParameters helper

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

var response structuredResponse
err := getJSON(ts.server.URL+`/api/traces?traceID=1&`+tc.query, &response)
require.Error(t, err)
})
Copy link
Member

Choose a reason for hiding this comment

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

how is this test different from the one on L426?

Copy link
Contributor Author

@rim99 rim99 Dec 21, 2024

Choose a reason for hiding this comment

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

updated with multiple traceIds

Copy link
Contributor Author

@rim99 rim99 Dec 21, 2024

Choose a reason for hiding this comment

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

Actually, URIs are different:

  • this is /api/traces?traceID=1, with a ?
  • the other is /api/traces/traceID=1, with a / in the same position

These are handled by different handler methods

Signed-off-by: Zhang Xin <zhangxin@outlook.com>
Signed-off-by: Zhang Xin <zhangxin@outlook.com>
Signed-off-by: Zhang Xin <zhangxin@outlook.com>
Signed-off-by: Zhang Xin <zhangxin@outlook.com>
Signed-off-by: Zhang Xin <zhangxin@outlook.com>
@rim99 rim99 force-pushed the optinal-time-window-when-fetching-trace-by-id branch from f9d81a5 to 3c56050 Compare December 21, 2024 13:32

func (aH *APIHandler) parseGetTraceParameters(w http.ResponseWriter, r *http.Request) (spanstore.GetTraceParameters, bool) {
traceID, traceIdOk := aH.parseTraceID(w, r)
startTime, startTimeOk := aH.parseMicroseconds(w, r, startTimeParam)
Copy link
Member

Choose a reason for hiding this comment

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

you cannot defer checking the error like that because helper functions already called aH.handleError which writes to the client (you cannot do that more than once).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see, updated as checking result immediately

Signed-off-by: Zhang Xin <zhangxin@outlook.com>
@yurishkuro yurishkuro merged commit 9fc9d75 into jaegertracing:main Dec 22, 2024
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: time parameters for querying trace by id
2 participants