Tag @Async @Scheduled spring-scheduling spans as errored on exception - #12071
Conversation
There was a problem hiding this comment.
More details
The async invocation path now decorates the child span and records exceptions before rethrowing, while preserving continuation scope lifecycle for both parent and no-parent executions. No concrete behavioral regression was identified in the changed branches; runtime test execution was blocked by the sandbox lacking the required Gradle distribution access and JDK 25.
🤖 Datadog Autotest · Commit dff8956 · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest
|
🎯 Code Coverage (details) 🔗 Commit SHA: d087e1d | Docs | Datadog PR Page | Give us feedback! |
🟡 Java Benchmark SLOs — Performance SLO warning (near threshold)
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
708e3f5 to
68a976b
Compare
|
@codex review |
| # Max agent jar size in bytes. Raise only when the size growth is intentional (~33.02 MiB). | ||
| jar.size.budget = 34619392 |
There was a problem hiding this comment.
I think you could bump it by a bit more than 10KB because otherwise we're going to be coming here often 🤔
There was a problem hiding this comment.
or maybe 10KB is plenty enough for just code changes, and it should be kept pretty tigh, idk
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
Build pipeline has failing jobs for 87cc705: What to do next?
DetailsSince those jobs are not marked as being allowed to fail, the pipeline will most likely fail. |
fa42e74 to
d087e1d
Compare
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
|
a92b3a6
into
master
What Does This Do
Marks the span of a Spring
@Async+@Scheduledmethod as errored when the method throws. Before, the exception was lost and the trace looked successful.Fix: add a
catchinSpannedMethodInvocationthat callsDECORATE.onError(...)and rethrows - the same handling the synchronous path already does. It also callsDECORATE.afterStart(...)so the async span carries thespring-schedulingcomponent/integration tags, like the sync span.Motivation
With
@Asyncthe method runs on a different thread. The parent span (scheduled.call) closes as soon as the task is submitted - before the body runs — and the exception is thrown later on the async thread, in a child span that had no error handling. So it closed cleanAdditional Notes
Tests:
SpringAsyncTest(default) +SpringAsyncMeasuredForkedTest(flag on)Optional: showing these errors on the Service/Resource pages
Optional - surfacing these errors on the Service/Resource pages.
The errored span is a child, not top-level, so by default it doesn't feed APM trace-metrics (same as any non-top-level span). A new opt-in flag
DD_SPRING_SCHEDULING_MEASURED_ENABLED(default off) marks spring-scheduling spansmeasuredso their errors show up on the stats pages, at the cost of a new APM operation per@Asyncmethod. It's modeled on the existinghystrix.measured.enabled/resilience4j.measured.enabledflags.Out of scope: methods that return an already-failing
Future(instead of throwing) are still not tagged.Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issueJira ticket: [PROJ-IDENT]