Repository navigation
Conversation
Each PTags allocated a lock Object and took its monitor for every sampling decision, though the sampling state is already an immutable snapshot behind one volatile field. Publish decisions with a compare-and-set on that field instead: compute the next state from the one read, and retry if another decision got there first. A deferred otel check is computed the same way, returning the next state rather than installing it. canChangeDecisionMaker becomes volatile, cleared before the decision maker is locked so a racing decision either lands first or retries seeing it cleared. setOtelTraceState had no callers and is removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
Contributor
🟢 Java Benchmark SLOs — All performance SLOs passed
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. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Does This Do
Sampling decisions on a trace's propagation tags now publish with a compare-and-set instead of a per-trace lock.
PTagsallocated a lockObjectand took its monitor for every decision. The sampling state is already an immutable snapshot behind one volatile field, so the lock only serialized computing the next snapshot.otcheck (Defer parsing the inherited OpenTelemetry tracestate member #13028) uses the same pattern: it returns the next state instead of installing it.canChangeDecisionMakerbecomes volatile. It is only ever cleared, and it's cleared before the decision maker is locked, so a racing decision either lands first and is overwritten, or retries and sees it cleared.setOtelTraceStatehad no callers on this stack and is removed.Motivation
Objectper trace.Testing
ConcurrentSamplingDecisionTestraces two decisions per trial (2000 trials) whose result is the same in either order:Mutation checks:
forceKeepwrites without retryingforceKeepoverwrites the whole state anywayCorpus and suites:
CompoundExtractionGoldenTestpasses.TracerConnectionReliabilityTest, order-dependentPendingTraceBufferTestflare dump).Additional Notes
dougqh/ptags-sampling-state-cas(written against master) onto this stack. That branch can be retired.🤖 Generated with Claude Code