[BUG] The thread context is not properly cleared and messes up the traces#10873
[BUG] The thread context is not properly cleared and messes up the traces#10873reta merged 3 commits intoopensearch-project:mainfrom
Conversation
Compatibility status:Checks if related components are compatible with change 7b1e67e Incompatible componentsIncompatible components: [https://github.com/opensearch-project/k-nn.git, https://github.com/opensearch-project/performance-analyzer.git] Skipped componentsCompatible componentsCompatible components: [https://github.com/opensearch-project/security-analytics.git, https://github.com/opensearch-project/asynchronous-search.git, https://github.com/opensearch-project/observability.git, https://github.com/opensearch-project/reporting.git, https://github.com/opensearch-project/job-scheduler.git, https://github.com/opensearch-project/opensearch-oci-object-storage.git, https://github.com/opensearch-project/sql.git, https://github.com/opensearch-project/custom-codecs.git, https://github.com/opensearch-project/common-utils.git, https://github.com/opensearch-project/security.git, https://github.com/opensearch-project/notifications.git, https://github.com/opensearch-project/ml-commons.git, https://github.com/opensearch-project/anomaly-detection.git, https://github.com/opensearch-project/index-management.git, https://github.com/opensearch-project/neural-search.git, https://github.com/opensearch-project/cross-cluster-replication.git, https://github.com/opensearch-project/alerting.git, https://github.com/opensearch-project/geospatial.git, https://github.com/opensearch-project/performance-analyzer-rca.git] |
Gradle Check (Jenkins) Run Completed with:
|
dbc073e to
8a06238
Compare
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #10873 +/- ##
============================================
+ Coverage 71.09% 71.14% +0.05%
- Complexity 58752 58785 +33
============================================
Files 4888 4888
Lines 277207 277221 +14
Branches 40282 40288 +6
============================================
+ Hits 197077 197226 +149
+ Misses 63654 63503 -151
- Partials 16476 16492 +16 ☔ View full report in Codecov by Sentry. |
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
|
Looking into it. |
libs/telemetry/src/main/java/org/opensearch/telemetry/tracing/SpanReference.java
Show resolved
Hide resolved
.../test/java/org/opensearch/telemetry/tracing/ThreadContextBasedTracerContextStorageTests.java
Show resolved
Hide resolved
.../test/java/org/opensearch/telemetry/tracing/ThreadContextBasedTracerContextStorageTests.java
Show resolved
Hide resolved
…aces Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
|
@andrross may I ask you please to approve, we worked with @Gaganjuneja to confirm the "mess" it gone for now but the work will continue, thank you. |
dblock
left a comment
There was a problem hiding this comment.
There should be a unit test for DefaultSpanScope that ensures attach/detach works in the various scenarios (e.g. exception).
libs/telemetry/src/main/java/org/opensearch/telemetry/tracing/DefaultSpanScope.java
Show resolved
Hide resolved
We do have tests for that actually, the reason why everything still work is that the |
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
|
The backport to To backport manually, run these commands in your terminal: # Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch/backport-2.x
# Create a new branch
git switch --create backport/backport-10873-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 00517eb21144065bd779c1777e723e5d8c1f0ecb
# Push it to GitHub
git push --set-upstream origin backport/backport-10873-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch/backport-2.xThen, create a pull request where the |
…aces (opensearch-project#10873) * [BUG] The thread context is not properly cleared and messes up the traces Signed-off-by: Andriy Redko <andriy.redko@aiven.io> * Address code review comments Signed-off-by: Andriy Redko <andriy.redko@aiven.io> * Address code review comments Signed-off-by: Andriy Redko <andriy.redko@aiven.io> --------- Signed-off-by: Andriy Redko <andriy.redko@aiven.io> (cherry picked from commit 00517eb)
…aces (#10873) (#11277) * [BUG] The thread context is not properly cleared and messes up the traces Signed-off-by: Andriy Redko <andriy.redko@aiven.io> * Address code review comments Signed-off-by: Andriy Redko <andriy.redko@aiven.io> * Address code review comments Signed-off-by: Andriy Redko <andriy.redko@aiven.io> --------- Signed-off-by: Andriy Redko <andriy.redko@aiven.io> (cherry picked from commit 00517eb) Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
…aces (opensearch-project#10873) * [BUG] The thread context is not properly cleared and messes up the traces Signed-off-by: Andriy Redko <andriy.redko@aiven.io> * Address code review comments Signed-off-by: Andriy Redko <andriy.redko@aiven.io> * Address code review comments Signed-off-by: Andriy Redko <andriy.redko@aiven.io> --------- Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
…aces (opensearch-project#10873) * [BUG] The thread context is not properly cleared and messes up the traces Signed-off-by: Andriy Redko <andriy.redko@aiven.io> * Address code review comments Signed-off-by: Andriy Redko <andriy.redko@aiven.io> * Address code review comments Signed-off-by: Andriy Redko <andriy.redko@aiven.io> --------- Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
…aces (opensearch-project#10873) * [BUG] The thread context is not properly cleared and messes up the traces Signed-off-by: Andriy Redko <andriy.redko@aiven.io> * Address code review comments Signed-off-by: Andriy Redko <andriy.redko@aiven.io> * Address code review comments Signed-off-by: Andriy Redko <andriy.redko@aiven.io> --------- Signed-off-by: Andriy Redko <andriy.redko@aiven.io> Signed-off-by: Shivansh Arora <hishiv@amazon.com>
Description
The thread context stashing messes up the propagation of the current span across thread boundaries (and even same thread boundary). It leads to split brain situation when some state is stored in
ThreadContextand in the thread local scope, which is difficult (if possible at all) to reconcile.Related Issues
Closes #10789
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.