Skip to content

Ensure context propagation for all stages of the Completab… - #51

Merged
helios57 merged 2 commits into
solacecommunity:masterfrom
cedric-schaller:bugfix/STTRS-3093
May 28, 2026
Merged

helios57 merged 2 commits into
solacecommunity:masterfrom
cedric-schaller:bugfix/STTRS-3093

Conversation

@cedric-schaller

Copy link
Copy Markdown

Fix for #50

@cedric-schaller cedric-schaller changed the title STTRS-3093 ensure context propagation for all stages of the Completab… Ensure context propagation for all stages of the Completab… May 26, 2026
@helios57
helios57 requested review from GreenRover and Copilot May 28, 2026 09:32
@helios57 helios57 self-assigned this May 28, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses issue #50 by ensuring Micrometer/OpenTelemetry context (e.g., MDC trace/span IDs) is propagated across asynchronous CompletableFuture execution in RequestReplyServiceImpl, so downstream stages added by callers don’t unexpectedly lose context.

Changes:

  • Replaced per-invocation ContextSnapshot.wrap(runnable) with a context-propagating wrapped ExecutorService (ContextExecutorService.wrap(...)).
  • Updated CompletableFuture.runAsync(...) and whenCompleteAsync(...) to use the wrapped executor service.
  • Adjusted runningRequests() to use the underlying ThreadPoolExecutor for getActiveCount().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Adds an integration test class that verifies the MDC / thread-local
context captured on the calling thread is propagated to the
request-sending thread and to stages chained on the returned
CompletableFuture, and that context is not leaked between pooled
requests. Also renames WRAPPED_EXECUTOR to DELEGATE_EXECUTOR to make
clear it is the executor being wrapped by the context-propagating one.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

@helios57
helios57 merged commit b3e5e7a into solacecommunity:master May 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants