[Feature]: Honor OTEL_TRACES_SAMPLER for durable spans
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- python
- Área
- observability
Línea de trabajo
Start with the current decision path in durable_sampling.py and review the related documentation issue #295 and the shared sampling contract. Because this issue requires an RFC, first settle the cross-language policy, parent-context inputs, defaults, and migration approach before implementation. Done means both Python views meet the policy matrix and regression criteria, with coordinated documentation and language behavior.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
What would you like?
Make both Python durable OpenTelemetry views honor the configured provider sampler selected through the standard OTEL_TRACES_SAMPLER and OTEL_TRACES_SAMPLER_ARG settings in supported ADOT/autoconfiguration setups.
Currently, an explicit propagated X-Ray Sampled=0/1 decision bypasses the configured sampler and is enforced for durable spans. Consequently, OTEL_TRACES_SAMPLER=always_off can drop ADOT handler/client spans while the durable plugin still exports Workflow, Invocation, operation, and attempt spans when the upstream header contains Sampled=1. This is the documented current behavior; this feature requests changing that contract so the selected sampler determines whether to inherit the parent decision.
Support the standard policies with their OpenTelemetry semantics:
| Configured sampler | Parent sampled (Sampled=1) |
Parent not sampled (Sampled=0) |
No parent supplied to sampler |
|---|---|---|---|
always_on |
Sample | Sample | Sample |
always_off |
Drop | Drop | Drop |
traceidratio |
Decide from trace ID and ratio | Decide from trace ID and ratio | Decide from trace ID and ratio |
parentbased_always_on |
Sample | Drop | Sample |
parentbased_always_off |
Sample | Drop | Drop |
parentbased_traceidratio |
Sample | Drop | Decide from trace ID and ratio |
Use OTEL_TRACES_SAMPLER_ARG for the ratio through the provider's existing configuration mechanism. A valid parent with an unset sampled bit is different from having no parent; retain OpenTelemetry ParentBased semantics for that case.
Possible Implementation
Use the provider's resolved sampler rather than adding a separate environment parser in the durable plugin. Preserve programmatically configured providers and their ownership/lifecycle; document which supported setup resolves environment configuration and how explicit provider configuration takes precedence.
Define the stable parent context supplied to the sampler. ParentBased policies must see the applicable propagated parent, while a root policy must receive no parent. Do not always evaluate ParentBased at root, or feed a synthesized sampled ancestor back into a root decision. Resolve the durable sampling decision consistently and apply it to every SDK-created span; ordinary application and ADOT spans retain their provider behavior.
Sampling must remain deterministic for a durable execution: use its stable canonical trace ID with policy/configuration unchanged across retries and reinvocations. Random, time-dependent, load-dependent, or mutable-state-dependent custom decisions remain unsupported. This feature does not request sampling-decision persistence or make in-memory caching an additional supported sampling mode.
Acceptance criteria:
- Both Execution and Invocation views implement the policy matrix through supported provider/autoconfiguration paths, including
OTEL_TRACES_SAMPLER_ARG. - Define and document behavior when the environment variables are unset, invalid, or superseded by programmatic provider configuration; reuse the provider's validation/default behavior where applicable.
- Test explicit upstream sampled/not-sampled contexts, a valid parent with no sampled flag, and no usable parent. Assert direct-sampler versus ParentBased behavior separately.
- With
always_offand upstreamSampled=1, no durable Workflow, Invocation, operation, attempt, or synthetic-root spans are exported in either the initial or resumed invocation. - Deterministic ratio tests exercise trace IDs on both sides of the threshold and initial invocation plus resume/retry. Every durable span follows the execution's resolved decision; completed user work is skipped on replay. Do not require exactly half of a small random batch to be sampled.
- Preserve provider ownership, ordinary application/ADOT span sampling, trace identity, and context cleanup. No persistent sampling-decision store is introduced.
- Keep a regression for sampled durable spans encountering a known dropped same-trace ambient handler parent. Honoring
always_offalone does not establish that every missing-parent case is fixed. Define the appropriate fallback and distinguish exporter evidence from X-Ray backend/console qualification. - Update the Python README and shared sampling contract with compatibility/migration guidance, and coordinate JavaScript/Java behavior and applicable language-neutral conformance requirements before implementing inconsistent per-language precedence.
Is this a breaking change?
Yes. This changes documented trace sampling behavior: explicit upstream Sampled=0/1 currently takes precedence regardless of the configured sampler. Describe migration to parentbased_* for applications that want to retain upstream sampling decisions. Define the unset/default behavior explicitly.
Does this require an RFC?
Yes. Settle the cross-language sampling contract, parent-context inputs, defaults, and compatibility approach before implementation.
Additional Context
- Related documentation issue: aws/aws-durable-execution-docs#295. That issue documents the existing support boundary and unconditional upstream precedence; this issue requests a runtime feature and requires coordinated updates to that contract.
- Current Python decision path: durable_sampling.py.
- Local reproduction on
44b9f4d1and4625d01bused an AlwaysOff provider, explicit upstream sampled context, and a same-trace handler span dropped by that provider. Across both views and initial/resumed invocations, all durable spans—including both Invocation spans—were exported sampled. Invocation parent IDs referred to the unexported handler spans. Removing that ambient span made Invocation fall back to the propagated remote parent. - Those checks establish local sampler and parent-selection behavior. They did not exercise the ADOT layer binary, the X-Ray exporter/backend, or console rendering. Retain real deployment/export evidence when qualifying the supported ADOT path.
The parent-selection case is a related regression requirement, not evidence that the durable sampler itself dropped Invocation spans. The separate replay-completion issue #854 concerns unvisited terminal operations and does not track this configuration behavior.
- Lenguaje dominante
- Python
- Estrellas
- 58
- Forks
- 32
- Merge medio
- 1 d 6 h
- PR fusionados (30 d)
- 80
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de aws/aws-durable-execution-sdk-python
-
enhancement needs-triage
Dificultad 1/5 1-3 horas Aptitud para principiantes 72/100
aws/aws-durable-execution-sdk-python#927 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
aws/aws-durable-execution-sdk-python#875 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
aws/aws-durable-execution-sdk-python#794 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 3/5 1-2 días Aptitud para principiantes 58/100
aws/aws-durable-execution-sdk-python#921 ·
Los mantenedores suelen responder en 1 día
-
[Bug]: JS examples CI still invokes Jest after Vitest migrationPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertobug needs-triage
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
aws/aws-durable-execution-sdk-python#918 ·
Los mantenedores suelen responder en 1 día
Todos los issues de aws/aws-durable-execution-sdk-python
Issues similares
-
physical
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
antonyrag/ragleap-core#1339 ·
-
enhancement good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
AllenCell/SubCellSeg#5 ·
-
[🐛 Bug]: oidc_authverifier.py strips trailing slash causing "Invalid token: Invalid issuer" errorAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
keephq/keep#6934 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
bug game: 01008BA02525A000 ios
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
needs-triage
Dificultad 1/5 Menos de una hora Aptitud para principiantes 87/100
gke-labs/kube-agents#5501 ·
Los mantenedores suelen responder en 1 día