Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
instrument spring scheduling @Async #1873
instrument spring scheduling @Async #1873
Changes from all commits
7ca3fed
447581d
01109f9
81a4258
bc2fb5e
cd7bd80
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 will hopefully be unnecessary with the planned changes to PendingTrace.
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.
There's a fair bit of history here, but I can't find any original sources. I think these summarize the problem well:
opentracing/opentracing-java#361 (comment)
https://github.com/Nike-Inc/wingtips#warning-about-error-handling-when-using-try-with-resources-to-autoclose-spans
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.
That reads like an issue with programming discipline, and sacrifices convenience in the common case for the inability to be incorrect in the rare case. Just my opinion.
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.
One other thing to mention is that currently this will result in the span likely being reported as a separate trace since you're not using continuations to force the trace to stick around.
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 think that is fine modeling wise because it's timing does not matter for the critical path
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'm confused by saying it is a separate trace, isn't it just spans sent separately? That's what I think it should be.
I think today. These spans might go to PendingTrace that is thought to be done, but I think that's a problem with PendingTrace.
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.
@dougqh to clarify, I mean it would likely be reported independently from the rest of the trace.
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 feels like the wrong API to me. I should need to call
AgentSpan.finish()
to finish the span.DDSpanContext
has aPendingTrace
- so why shouldn'tAgentSpan.finish()
be enough to hold thePendingTrace
back?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.
Yes, right now, an unfinished span holds back sending the trace leg.
But that's leading to problems where an unfinished span, holds back the whole trace.
I think we want to get away from that.
My thought is that a span is published in the first payload when it finishes before the root span.
(Except for long root spans for batch jobs where we need to send sooner).
Otherwise, the span is deemed to have finished late. If it makes it with a grace period, it can be included. Otherwise, it goes separately. But basically, it is only guarantee if it finishes before the root.
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'm a little concerned about adding instrumentation for a class that seems relatively unrelated to scheduling in the module for
spring-scheduling
. Is@Async
used for anything besides spring scheduling?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 intercepts the annotation (notice the package)
org.springframework.scheduling.annotation.Async
.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.
Yes, this seems pretty clearly related to Async to me. Although, I'll admit their package naming makes me a little concern that maybe AsyncExecutionInterceptor does more.
But presuming AsyncExecutionInterceptor is specific to
@Async
annotations, I think this is probably the right place.It solves my general aim which to let the frameworks find the target methods for us -- rather than us seeking them out.
This file was deleted.