-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Capture task span context in thread context to parent nested tasks #80758
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
Capture task span context in thread context to parent nested tasks #80758
Conversation
Pinging @elastic/es-distributed (Team:Distributed) |
@@ -81,7 +131,7 @@ public void onTaskUnregistered(Task task) { | |||
|
|||
public static class CapturingSpanExporter implements SpanExporter { | |||
|
|||
private List<SpanData> capturedSpans = new ArrayList<>(); | |||
private List<SpanData> capturedSpans = Collections.synchronizedList(new ArrayList<>()); |
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.
This was populated in small chunks from multiple threads and loosing updates sometimes
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.
Not being at all familiar with the OpenTelemetry API, but having reviewed all the relevant PRs up until this point: LGTM. (Once CI is happy)
@elasticmachine please run elasticsearch-ci/part-1 |
@elasticmachine please run elasticsearch-ci/part-2 |
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.
Hopefully CI will be happy with this, LGTM at least.
x-pack/plugin/apm-integration/src/main/java/org/elasticsearch/xpack/apm/APM.java
Outdated
Show resolved
Hide resolved
1dd8e9e
to
516d0e5
Compare
x-pack/plugin/apm-integration/src/main/java/org/elasticsearch/xpack/apm/APMTracer.java
Outdated
Show resolved
Hide resolved
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.
LGTM
* {@link StoredContext}. | ||
* @param headersToRemove the request headers to remove | ||
*/ | ||
public StoredContext removeRequestHeaders(Set<String> headersToRemove) { |
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.
nit: I'd call this stashWithoutHeader()
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.
As the other stashXXX()
methods start off with the default thread context, I avoided prefixing this one with stash
. I don't feel strongly on it though. What do you reckon @DaveCTurner ?
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.
I see, feel free to merge like it is so that we don't waste time on naming :)
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.
Yeah I also don't want to say stash
. I didn't come up with an obviously better name, although maybe I'd have called it something like withoutRequestHeaders
or removingRequestHeaders
rather than using the imperative remove
. NBD anyway, naming is hard.
13875ee
to
886255c
Compare
Pass a task's span context via the
ThreadContext
to parent nested tasks.