Fine tune async propagation for lettuce 5#11607
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
💡 Codex Review
When connect/connectAsync is called while an application span is active, this whenComplete registration now runs with the connect span no longer active but with async propagation still enabled. Since ConnectionFuture is a completable future, the java-concurrent instrumentation can capture the caller's active span for this Datadog-internal completion callback, keeping that continuation alive until the connection attempt completes and reactivating it just to finish the connect span; slow or failed connects can therefore leak/delay the caller trace. The command path added a propagation guard around its own whenComplete, and the connect path needs the same guard here.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bfcbd9b949
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| isMethod().and(namedOneOf("complete", "completeExceptionally", "encode")), | ||
| getClass().getName() + "$Activate"); | ||
| transformer.applyAdvice( | ||
| isMethod().and(named("onComplete")), getClass().getName() + "$SuppressAsyncPropagation"); |
There was a problem hiding this comment.
Preserve propagation for user onComplete callbacks
This matcher now applies to every AsyncCommand.onComplete invocation, not just Lettuce's internal registrations. When application code registers a completion callback under an active request span via onComplete, the new advice disables async propagation while onComplete delegates to the underlying CompletableFuture, so that callback and any async work it schedules are no longer linked to the request/Redis trace; previously this path was covered by Activate and propagated the command context. Please narrow the suppression to the internal registration path or keep user-visible onComplete callbacks propagating.
Useful? React with 👍 / 👎.
🟡 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. |
What Does This Do
This PR blocks async propagations around few boundaries in lettuce. Previously, the latestDepTest had a strictTraceWrites set to false since continuations were leaked from few places. Hence:
SHUTDOWN.I've tried to mutually exclude fixes in order to have the minimal changes applied to the propagation
Motivation
Additional Notes
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 issue/merge. You can also:/merge --commit-message "..."/merge -c/merge -f --reason "reason"; please use this judiciously, as some checks do not run at the PR-level (note: the PR still needs to be mergeable, this will only skip the pre-merge build)Jira ticket: [PROJ-IDENT]