You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OpenTelemetry instrumentation plugin for the [AWS Durable Execution SDK for Python](https://github.com/aws/aws-durable-execution-sdk-python). Emits durable execution spans with deterministic workflowand operation IDs while keeping invocation spans in the ambient Lambda trace.
3
+
OpenTelemetry instrumentation plugin for the [AWS Durable Execution SDK for Python](https://github.com/aws/aws-durable-execution-sdk-python). Emits durable execution spans on one execution trace, with deterministic workflow, synthetic-root, and operation span IDs.
4
4
5
5
## Features
6
6
7
-
-**Deterministic Workflow Traces**: Durable operations use an execution-derived trace that is independent of the ambient Lambda/X-Ray trace
8
-
-**Ambient Invocation Traces**: Invocation spans inherit the active Lambda or extracted upstream context
7
+
-**Shared Execution Trace**: Workflow and Invocation spans share one trace, anchored to a propagated backend parent when available or a deterministic synthetic execution root otherwise
8
+
-**Same-Trace Ambient Parenting**: Invocation spans use the active ambient span only when it already belongs to the execution trace
9
9
-**Span-per-Operation**: Each durable operation (step, wait, invoke) gets its own span with accurate timing
10
10
-**Continuation Spans**: Operations completing in another invocation produce a new correlated span without fabricating an unobserved prior span context
11
11
-**Log Correlation**: Enrich application logs with trace ID and span ID for end-to-end observability
12
12
-**Provider Integration**: Use the global ADOT provider or supply an explicit SDK `TracerProvider`
13
-
-**Provider-Managed Sampling**: Use standard OpenTelemetry or ADOT sampling configuration
13
+
-**Execution Sampling**: Resolve sampling once per invocation and apply it consistently to Workflow, Invocation, operation, and attempt spans
14
14
15
15
## Installation
16
16
@@ -124,7 +124,7 @@ fn = lambda_.Function(
124
124
125
125
### 2. AWS X-Ray Active Tracing
126
126
127
-
Enable active tracing on your Lambda function so the `_X_AMZN_TRACE_ID` environment variable is populated at invocation time. The plugin uses this header to derive deterministic trace IDs that remain consistent across all invocations of the same durable execution.
127
+
Enable active tracing on your Lambda function so the `_X_AMZN_TRACE_ID` environment variable is populated at invocation time. The plugin uses this header to anchor the execution trace on the propagated X-Ray `Root`/`Parent` when both are valid, and preserves `Sampled=1` or `Sampled=0` as the backend sampling decision.
128
128
129
129
**AWS Console:** Lambda → Configuration → Monitoring and operations tools → Active tracing → Enable
130
130
@@ -191,7 +191,7 @@ The function's execution role needs the `AWSXRayDaemonWriteAccess` managed polic
191
191
|`OTEL_TRACES_SAMPLER`| Sampler to use (e.g., `traceidratio` for ratio-based sampling) |`always_on`|
192
192
|`OTEL_TRACES_SAMPLER_ARG`| Argument for the sampler (e.g., `0.3` to sample 30% of traces) | — |
193
193
194
-
See the [ADOT sampling configuration](https://aws-otel.github.io/docs/getting-started/lambda#sampling-configuration) for more details.
194
+
See the [ADOT sampling configuration](https://aws-otel.github.io/docs/getting-started/lambda#sampling-configuration) for more details. When the backend header contains an explicit `Sampled` value, that backend decision takes precedence over local sampler configuration for durable spans.
| No traces appear | ADOT layer not configured, or `AWS_LAMBDA_EXEC_WRAPPER` not set |
275
-
| Traces appear but are fragmented |X-Ray active tracing not enabled on the Lambda function |
336
+
| Traces appear but are fragmented |Backend trace context is not propagated to every invocation|
276
337
| Missing spans for some operations |`OTEL_TRACES_SAMPLER_ARG` set below 1.0 |
277
338
|`_X_AMZN_TRACE_ID` not populated | X-Ray active tracing not enabled |
278
339
279
340
## API Reference
280
341
281
342
### `InvocationOtelPlugin`
282
343
283
-
The main plugin class. Implements `DurableInstrumentationPlugin` from `aws_durable_execution_sdk_python`.
344
+
Invocation-rooted view. Implements `DurableInstrumentationPlugin` from `aws_durable_execution_sdk_python`.
284
345
285
346
```python
286
347
InvocationOtelPlugin(
@@ -297,21 +358,35 @@ InvocationOtelPlugin(
297
358
Pass `tracer_provider=...` when the application owns the OpenTelemetry SDK
298
359
provider. When omitted, the globally configured provider is used.
299
360
361
+
### `ExecutionOtelPlugin`
362
+
363
+
Execution-rooted view. Uses the same execution ancestor and sampling behavior as
364
+
`InvocationOtelPlugin`, but parents operation spans under Workflow and links
365
+
them to Invocation.
366
+
300
367
### `DeterministicIdGenerator`
301
368
302
369
A custom OpenTelemetry `IdGenerator` that produces reproducible trace and span IDs from execution metadata. Exported for advanced use cases.
303
370
304
371
### `xray_context_extractor`
305
372
306
-
Default context extractor. Reads the `_X_AMZN_TRACE_ID` environment variable to derive trace context.
373
+
Default context extractor. Reads the `_X_AMZN_TRACE_ID` environment variable and
374
+
returns `ExtractedContext` containing parsed `Root`, `Parent`, and `Sampled`
375
+
fields when present.
307
376
308
377
### `w3c_client_context_extractor`
309
378
310
-
Alternative context extractor. Reads W3C `traceparent` from `context.clientContext.custom.traceparent`. Requires backend `clientContext` propagation to be enabled.
379
+
Alternative context extractor placeholder. Returns `None` until backend W3C
380
+
`traceparent` propagation is supported.
311
381
312
382
### `ContextExtractor`
313
383
314
-
Type alias for custom context extractor functions.
384
+
Type alias for custom context extractor functions:
0 commit comments