Repository navigation
feat(otel)!: honor configured samplers for durable spans - #875
Draft
zhongkechen wants to merge 1 commit into
Draft
zhongkechen wants to merge 1 commit into
zhongkechen wants to merge 1 commit into
Conversation
Resolve sampling from the canonical trace and original remote parent in both provider and deferred agent paths. Keep ordinary spans delegated, qualify replay and autoconfiguration, and document the proposed migration. Refs aws#853; shared contract aws/aws-durable-execution-docs#308.
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.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Issue Link, if available
Closes #853.
Draft pending agreement on the shared sampling RFC and coordinated conformance contract. Related: JavaScript implementation #1173, Python #887, and shared docs #295. This must not ship as an unannounced patch-level behavior change.
Description
Both durable views now honor the provider's configured sampler. For example,
always_offdrops Workflow, Invocation, operation, attempt and synthetic-root spans even when the incoming X-Ray header saysSampled=1.parentbased_*preserves upstream inheritance; directalways_on,always_offandtraceidratiouse their standard OTel semantics.Resolve from the canonical execution trace ID and original complete propagated remote parent. A valid parent without a sampled flag is unsampled; an invalid/incomplete parent supplies root context. Ambient handlers and synthesized ancestors never become sampling inputs. Carry this original parent through the existing agent bridge and preserve full sampling results in supported provider/loader arrangements. Invocation parenting falls back from a known dropped same-trace ambient handler to the execution ancestor.
Environment parsing,
OTEL_TRACES_SAMPLER_ARG, defaults, validation and ownership stay with the provider. Ordinary spans retain its delegate behavior. The process cache remains an optimization, with no persisted decisions or support for nondeterministic policies. README migration guidance is explicitly unreleased and links the shared proposal.Demo/Screenshots
No UI change. Exporter assertions cover both views; no X-Ray console qualification is claimed.
Design
Design note, following the proposed shared RFC and the implementation outline in #853. Maintainer/cross-language agreement is pending; keep this PR draft until that prerequisite is settled.
Assumptions
Decisions not covered by the issue or the design note
Checklist
Testing
Java 17 validation passed across the Maven reactor: 3992 tests, zero remaining failures/errors, 36 skipped tests (31 cloud examples and five existing SDK skips). The initial
mvn -B spotless:apply installrun hit one intermittent checkpoint-count assertion in the unchangedBackendOperationTimingTest(expected 1, observed 2);mvn -B spotless:apply install -rf :aws-durable-execution-sdk-java-plugin-otelreran all 1,256 OTel tests successfully and completed all remaining modules. No change was made to that timing test.mvn -B spotless:check,git diff --check, local documentation link checks, Python/YAML/shell syntax checks, the exact new CI environment-probe commands (25/25 configurations), and the existing installed OTel API compatibility matrix (4/4) passed. Cloud example tests and deployed cross-language conformance were not run.Unit Tests
New deferred-parent matrix covers all six policies in local and separate plugin classloaders, original flags/tracestate, full RECORD_ONLY results, cache reuse/cold recomputation, and ordinary-span isolation. Real handler-span tests distinguish DROP, RECORD_ONLY, sampled, unrelated and missing ambient parents.
Edited expectations and fixtures:
DurableSamplerTestexplicit sampled/unsampled conflict testsOtelPluginSupportTestExecutionTraceContextTestundecided-parent and incomplete-parent testsExecutionOtelPluginTest.xrayExtraction_undecidedSampling_parentBasedSampler_*ExecutionRootParityTest.completeRemoteParentRetainsNormalPerSpanPolicyReplacementSamplerPolicyTest,VisibleReplacementSdkSpanPolicyTestExecutionRootTestanchor ownership and processor isolationDurableSamplingDecisionClassLoaderTest,SamplingProcessorIsolationTest,RootStartProcessorIsolationTestInvocationHeaderTest,OtelPropagationMetadataTest,InvokePropagationIntegrationTest,PluginStartupOrderTestIntegration Tests
ConfiguredSamplerIntegrationTestadds 152 cases. Against based71d588c, 60 fail (zero errors); all pass with this implementation. The 24 real runner resume/retry cases use fixed trace IDs on both sides of the ratio threshold, verify every durable span's selection, and assert completed user work executes once.The standalone actual-autoconfiguration probe fails 18 of 25 configuration processes on the base and passes all 25 with this change: 864 initial/resume scenarios, plus seven invalid-configuration rejections. It is now part of the Build workflow. Instructions: SAMPLING.md.
Examples
No new executable example; the README documents the policy matrix, provider configuration, compatibility boundary and migration to
parentbased_*.