Skip to content

Conversation

RanVaknin
Copy link
Contributor

@RanVaknin RanVaknin commented Sep 2, 2025

This PR adds a new thread-context module that provides thread-local storage utilities for sharing data across components, specifically to support trace ID propagation.

Background

Previously, we implemented trace ID propagation using SLF4J's MDC in PR #6363, but this was
reverted because the MDC interface exists but the implementation is not provided by the SDK, Lambda runtime, or X-Ray SDK.

Solution

Added a small ThreadStorage utility class that provides thread local key value storage using ThreadLocal<Map<String, String>>. For this case, it allows the Lambda Runtime Interface Client, AWS SDK, and X-Ray SDK to share trace context via this one package, but can extended to other use cases.

Example:

ThreadStorage.put("some-value", foo);
String traceId = ThreadStorage.get("some-value");
ThreadStorage.remove("some-value");
ThreadStorage.clear();

@RanVaknin RanVaknin requested a review from a team as a code owner September 2, 2025 21:16
Copy link

sonarqubecloud bot commented Sep 2, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@RanVaknin RanVaknin closed this Sep 3, 2025
Copy link

github-actions bot commented Sep 3, 2025

This pull request has been closed and the conversation has been locked. Comments on closed PRs are hard for our team to see. If you need more assistance, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant