-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] The thread context is not properly cleared and messes up the traces #10873
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
Outdated
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.x Then, 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
ThreadContext
and 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.