aws-durable-execution-sdk-python-otel 0.3.0__tar.gz → 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {aws_durable_execution_sdk_python_otel-0.3.0 → aws_durable_execution_sdk_python_otel-1.0.0}/PKG-INFO +167 -54
- {aws_durable_execution_sdk_python_otel-0.3.0 → aws_durable_execution_sdk_python_otel-1.0.0}/README.md +159 -46
- {aws_durable_execution_sdk_python_otel-0.3.0 → aws_durable_execution_sdk_python_otel-1.0.0}/pyproject.toml +12 -3
- {aws_durable_execution_sdk_python_otel-0.3.0 → aws_durable_execution_sdk_python_otel-1.0.0}/src/aws_durable_execution_sdk_python_otel/__about__.py +1 -1
- aws_durable_execution_sdk_python_otel-1.0.0/src/aws_durable_execution_sdk_python_otel/__init__.py +54 -0
- aws_durable_execution_sdk_python_otel-1.0.0/src/aws_durable_execution_sdk_python_otel/context_extractors.py +132 -0
- aws_durable_execution_sdk_python_otel-1.0.0/src/aws_durable_execution_sdk_python_otel/deterministic_id_generator.py +172 -0
- aws_durable_execution_sdk_python_otel-1.0.0/src/aws_durable_execution_sdk_python_otel/durable_parent_span.py +159 -0
- aws_durable_execution_sdk_python_otel-1.0.0/src/aws_durable_execution_sdk_python_otel/durable_sampling.py +212 -0
- aws_durable_execution_sdk_python_otel-1.0.0/src/aws_durable_execution_sdk_python_otel/execution_plugin.py +907 -0
- aws_durable_execution_sdk_python_otel-1.0.0/src/aws_durable_execution_sdk_python_otel/execution_trace_context.py +98 -0
- aws_durable_execution_sdk_python_otel-1.0.0/src/aws_durable_execution_sdk_python_otel/invocation_plugin.py +966 -0
- {aws_durable_execution_sdk_python_otel-0.3.0 → aws_durable_execution_sdk_python_otel-1.0.0}/src/aws_durable_execution_sdk_python_otel/log_filter.py +15 -4
- aws_durable_execution_sdk_python_otel-1.0.0/src/aws_durable_execution_sdk_python_otel/otel_plugin_config.py +50 -0
- aws_durable_execution_sdk_python_otel-1.0.0/src/aws_durable_execution_sdk_python_otel/plugin_provider.py +23 -0
- aws_durable_execution_sdk_python_otel-1.0.0/src/aws_durable_execution_sdk_python_otel/provider.py +45 -0
- aws_durable_execution_sdk_python_otel-1.0.0/tests/e2e/test_invocation_wait_resume_int.py +255 -0
- aws_durable_execution_sdk_python_otel-1.0.0/tests/test_context_extractors.py +128 -0
- aws_durable_execution_sdk_python_otel-1.0.0/tests/test_deterministic_id_generator.py +341 -0
- aws_durable_execution_sdk_python_otel-1.0.0/tests/test_durable_sampling.py +497 -0
- aws_durable_execution_sdk_python_otel-1.0.0/tests/test_execution_plugin.py +1622 -0
- aws_durable_execution_sdk_python_otel-1.0.0/tests/test_execution_plugin_integration.py +459 -0
- aws_durable_execution_sdk_python_otel-1.0.0/tests/test_execution_trace_context.py +202 -0
- aws_durable_execution_sdk_python_otel-1.0.0/tests/test_instrumentation_ownership.py +48 -0
- aws_durable_execution_sdk_python_otel-1.0.0/tests/test_invocation_plugin.py +2200 -0
- aws_durable_execution_sdk_python_otel-1.0.0/tests/test_invocation_plugin_integration.py +427 -0
- {aws_durable_execution_sdk_python_otel-0.3.0 → aws_durable_execution_sdk_python_otel-1.0.0}/tests/test_log_filter.py +11 -9
- aws_durable_execution_sdk_python_otel-1.0.0/tests/test_package_metadata.py +82 -0
- aws_durable_execution_sdk_python_otel-1.0.0/tests/test_plugin_provider.py +56 -0
- aws_durable_execution_sdk_python_otel-1.0.0/tests/test_provider.py +35 -0
- aws_durable_execution_sdk_python_otel-0.3.0/src/aws_durable_execution_sdk_python_otel/__init__.py +0 -30
- aws_durable_execution_sdk_python_otel-0.3.0/src/aws_durable_execution_sdk_python_otel/context_extractors.py +0 -40
- aws_durable_execution_sdk_python_otel-0.3.0/src/aws_durable_execution_sdk_python_otel/deterministic_id_generator.py +0 -127
- aws_durable_execution_sdk_python_otel-0.3.0/src/aws_durable_execution_sdk_python_otel/plugin.py +0 -548
- aws_durable_execution_sdk_python_otel-0.3.0/tests/test_context_extractors.py +0 -66
- aws_durable_execution_sdk_python_otel-0.3.0/tests/test_deterministic_id_generator.py +0 -285
- aws_durable_execution_sdk_python_otel-0.3.0/tests/test_plugin.py +0 -800
- {aws_durable_execution_sdk_python_otel-0.3.0 → aws_durable_execution_sdk_python_otel-1.0.0}/.gitignore +0 -0
- {aws_durable_execution_sdk_python_otel-0.3.0 → aws_durable_execution_sdk_python_otel-1.0.0}/LICENSE +0 -0
- {aws_durable_execution_sdk_python_otel-0.3.0 → aws_durable_execution_sdk_python_otel-1.0.0}/NOTICE +0 -0
- {aws_durable_execution_sdk_python_otel-0.3.0 → aws_durable_execution_sdk_python_otel-1.0.0}/src/aws_durable_execution_sdk_python_otel/py.typed +0 -0
- {aws_durable_execution_sdk_python_otel-0.3.0 → aws_durable_execution_sdk_python_otel-1.0.0}/tests/__init__.py +0 -0
- {aws_durable_execution_sdk_python_otel-0.3.0 → aws_durable_execution_sdk_python_otel-1.0.0}/tests/test_init.py +0 -0
{aws_durable_execution_sdk_python_otel-0.3.0 → aws_durable_execution_sdk_python_otel-1.0.0}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: aws-durable-execution-sdk-python-otel
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.0
|
|
4
4
|
Summary: OpenTelemetry instrumentation for AWS Durable Execution SDK for Python
|
|
5
5
|
Project-URL: Documentation, https://github.com/aws/aws-durable-execution-sdk-python#readme
|
|
6
6
|
Project-URL: Issues, https://github.com/aws/aws-durable-execution-sdk-python/issues
|
|
@@ -8,7 +8,7 @@ Project-URL: Source, https://github.com/aws/aws-durable-execution-sdk-python
|
|
|
8
8
|
Author-email: AWS durable-execution-dev <durable-execution-dev@amazon.com>
|
|
9
9
|
License-Expression: Apache-2.0
|
|
10
10
|
Keywords: durable-execution,observability,opentelemetry,tracing
|
|
11
|
-
Classifier: Development Status ::
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
12
|
Classifier: Programming Language :: Python
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.11
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.12
|
|
@@ -17,39 +17,70 @@ Classifier: Programming Language :: Python :: 3.14
|
|
|
17
17
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
18
18
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
19
19
|
Requires-Python: >=3.11
|
|
20
|
-
Requires-Dist: aws-durable-execution-sdk-python>=
|
|
21
|
-
|
|
22
|
-
Requires-Dist: opentelemetry-
|
|
23
|
-
Requires-Dist: opentelemetry-propagator-aws-xray
|
|
24
|
-
Requires-Dist: opentelemetry-sdk>=1.20.0
|
|
20
|
+
Requires-Dist: aws-durable-execution-sdk-python>=2.0.0
|
|
21
|
+
Provides-Extra: standalone
|
|
22
|
+
Requires-Dist: opentelemetry-api>=1.20.0; extra == 'standalone'
|
|
23
|
+
Requires-Dist: opentelemetry-propagator-aws-xray; extra == 'standalone'
|
|
24
|
+
Requires-Dist: opentelemetry-sdk>=1.20.0; extra == 'standalone'
|
|
25
25
|
Description-Content-Type: text/markdown
|
|
26
26
|
|
|
27
27
|
# AWS Durable Execution SDK - OpenTelemetry Plugin
|
|
28
28
|
|
|
29
|
-
OpenTelemetry instrumentation plugin for the [AWS Durable Execution SDK for Python](https://github.com/aws/aws-durable-execution-sdk-python). Emits
|
|
29
|
+
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.
|
|
30
30
|
|
|
31
31
|
## Features
|
|
32
32
|
|
|
33
|
-
- **
|
|
33
|
+
- **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
|
|
34
|
+
- **Same-Trace Ambient Parenting**: Invocation spans use the active ambient span only when it already belongs to the execution trace
|
|
34
35
|
- **Span-per-Operation**: Each durable operation (step, wait, invoke) gets its own span with accurate timing
|
|
35
|
-
- **Continuation Spans**: Operations completing in a
|
|
36
|
+
- **Continuation Spans**: Operations completing in another invocation produce a new correlated span without fabricating an unobserved prior span context
|
|
36
37
|
- **Log Correlation**: Enrich application logs with trace ID and span ID for end-to-end observability
|
|
37
|
-
- **
|
|
38
|
-
- **
|
|
38
|
+
- **Provider Integration**: Use the global ADOT provider or supply an explicit SDK `TracerProvider`
|
|
39
|
+
- **Execution Sampling**: Resolve sampling once per invocation and apply it consistently to Workflow, Invocation, operation, and attempt spans
|
|
39
40
|
|
|
40
41
|
## Installation
|
|
41
42
|
|
|
43
|
+
When using an ADOT or community OpenTelemetry Lambda layer:
|
|
44
|
+
|
|
42
45
|
```bash
|
|
43
46
|
pip install aws-durable-execution-sdk-python-otel
|
|
44
47
|
```
|
|
45
48
|
|
|
49
|
+
The base package intentionally does not install OpenTelemetry libraries. The
|
|
50
|
+
Lambda layer supplies a version-aligned API, SDK, exporter, and propagators,
|
|
51
|
+
preventing packages in the function artifact from shadowing parts of the layer.
|
|
52
|
+
|
|
53
|
+
For an application that configures its own OpenTelemetry provider instead of
|
|
54
|
+
using a Lambda layer:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install "aws-durable-execution-sdk-python-otel[standalone]"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The `standalone` extra installs the OpenTelemetry API, SDK, and AWS X-Ray
|
|
61
|
+
propagator. The application remains responsible for configuring its provider,
|
|
62
|
+
processors, and exporter.
|
|
63
|
+
|
|
46
64
|
## Quick Start using X-Ray/CloudWatch Tracing
|
|
47
65
|
|
|
48
66
|
1. Add the [ADOT Lambda Layer](#1-adot-lambda-layer) to your function and set `AWS_LAMBDA_EXEC_WRAPPER=/opt/otel-instrument`
|
|
49
67
|
2. Enable [X-Ray Active Tracing](#2-aws-x-ray-active-tracing) on the function
|
|
50
|
-
3. Pass `
|
|
68
|
+
3. Pass `InvocationOtelPlugin` to your handler's `plugins` list
|
|
51
69
|
4. Add X-Ray write permissions
|
|
52
70
|
|
|
71
|
+
Alternatively, install this package in the function artifact or a Lambda layer
|
|
72
|
+
and select either OTel plugin by entry-point name:
|
|
73
|
+
|
|
74
|
+
```text
|
|
75
|
+
DURABLE_EXECUTION_PLUGINS=otel-invocation
|
|
76
|
+
DURABLE_EXECUTION_PLUGINS=otel-execution
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
`otel-invocation` creates `InvocationOtelPlugin`; `otel-execution` creates
|
|
80
|
+
`ExecutionOtelPlugin`. The SDK discovers the selected package entry point at
|
|
81
|
+
cold start, so the handler does not need to import or explicitly register the
|
|
82
|
+
plugin.
|
|
83
|
+
|
|
53
84
|
### 1. ADOT Lambda Layer
|
|
54
85
|
|
|
55
86
|
This plugin requires the [AWS Distro for OpenTelemetry (ADOT) Lambda layer](https://aws-otel.github.io/docs/getting-started/lambda) to export traces from your Lambda function.
|
|
@@ -119,7 +150,7 @@ fn = lambda_.Function(
|
|
|
119
150
|
|
|
120
151
|
### 2. AWS X-Ray Active Tracing
|
|
121
152
|
|
|
122
|
-
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
|
|
153
|
+
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.
|
|
123
154
|
|
|
124
155
|
**AWS Console:** Lambda → Configuration → Monitoring and operations tools → Active tracing → Enable
|
|
125
156
|
|
|
@@ -156,10 +187,10 @@ lambda_.Function(
|
|
|
156
187
|
```python
|
|
157
188
|
from aws_durable_execution_sdk_python import DurableContext
|
|
158
189
|
from aws_durable_execution_sdk_python.execution import durable_execution
|
|
159
|
-
from aws_durable_execution_sdk_python_otel import
|
|
190
|
+
from aws_durable_execution_sdk_python_otel import InvocationOtelPlugin
|
|
160
191
|
|
|
161
192
|
|
|
162
|
-
@durable_execution(plugins=[
|
|
193
|
+
@durable_execution(plugins=[InvocationOtelPlugin()])
|
|
163
194
|
def handler(event: dict, context: DurableContext) -> dict:
|
|
164
195
|
result = context.step(lambda _: fetch_data(event["id"]), name="fetch-data")
|
|
165
196
|
|
|
@@ -170,7 +201,8 @@ def handler(event: dict, context: DurableContext) -> dict:
|
|
|
170
201
|
return result
|
|
171
202
|
```
|
|
172
203
|
|
|
173
|
-
|
|
204
|
+
The ADOT layer supplies the global `TracerProvider`; the plugin handles
|
|
205
|
+
deterministic ID generation and span lifecycle.
|
|
174
206
|
|
|
175
207
|
### 4. Grant Permissions
|
|
176
208
|
|
|
@@ -185,7 +217,7 @@ The function's execution role needs the `AWSXRayDaemonWriteAccess` managed polic
|
|
|
185
217
|
| `OTEL_TRACES_SAMPLER` | Sampler to use (e.g., `traceidratio` for ratio-based sampling) | `always_on` |
|
|
186
218
|
| `OTEL_TRACES_SAMPLER_ARG` | Argument for the sampler (e.g., `0.3` to sample 30% of traces) | — |
|
|
187
219
|
|
|
188
|
-
See the [ADOT sampling configuration](https://aws-otel.github.io/docs/getting-started/lambda#sampling-configuration) for more details.
|
|
220
|
+
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.
|
|
189
221
|
|
|
190
222
|
## Configuration
|
|
191
223
|
|
|
@@ -193,43 +225,104 @@ See the [ADOT sampling configuration](https://aws-otel.github.io/docs/getting-st
|
|
|
193
225
|
|
|
194
226
|
```python
|
|
195
227
|
from aws_durable_execution_sdk_python_otel import (
|
|
196
|
-
|
|
228
|
+
InvocationOtelPlugin,
|
|
229
|
+
OtelPluginConfig,
|
|
197
230
|
xray_context_extractor,
|
|
198
231
|
)
|
|
199
232
|
|
|
200
|
-
plugin =
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
enrich_logger=True,
|
|
233
|
+
plugin = InvocationOtelPlugin(
|
|
234
|
+
OtelPluginConfig(
|
|
235
|
+
# Use a custom context extractor (default: xray_context_extractor).
|
|
236
|
+
context_extractor=xray_context_extractor,
|
|
237
|
+
# Custom instrumentation scope name
|
|
238
|
+
# (default: "aws-durable-execution-sdk-python").
|
|
239
|
+
instrument_name="my-service",
|
|
240
|
+
# Install a root-logger filter that stamps trace context onto every
|
|
241
|
+
# log record (default: True).
|
|
242
|
+
enrich_logger=True,
|
|
243
|
+
)
|
|
212
244
|
)
|
|
213
245
|
```
|
|
214
246
|
|
|
215
247
|
### Context Extractors
|
|
216
248
|
|
|
217
|
-
|
|
249
|
+
Context extractors return an `ExtractedContext` object, or `None` when no
|
|
250
|
+
durable execution trace context is available. The object carries:
|
|
251
|
+
|
|
252
|
+
- `trace_id`: 128-bit OpenTelemetry trace ID
|
|
253
|
+
- `parent_span_id`: 64-bit OpenTelemetry parent span ID
|
|
254
|
+
- `sampling`: `Sampling.SAMPLED`, `Sampling.NOT_SAMPLED`, or `Sampling.UNDECIDED`
|
|
255
|
+
|
|
256
|
+
The plugin supports multiple strategies for extracting durable execution trace
|
|
257
|
+
context:
|
|
218
258
|
|
|
219
259
|
```python
|
|
220
260
|
from aws_durable_execution_sdk_python_otel import (
|
|
221
|
-
|
|
261
|
+
InvocationOtelPlugin,
|
|
262
|
+
OtelPluginConfig,
|
|
222
263
|
w3c_client_context_extractor,
|
|
223
264
|
xray_context_extractor,
|
|
224
265
|
)
|
|
225
266
|
|
|
226
|
-
# Default: X-Ray trace header (recommended for most Lambda deployments)
|
|
227
|
-
|
|
267
|
+
# Default: X-Ray trace header (recommended for most Lambda deployments).
|
|
268
|
+
InvocationOtelPlugin(OtelPluginConfig(context_extractor=xray_context_extractor))
|
|
228
269
|
|
|
229
|
-
# W3C Trace Context via clientContext (
|
|
230
|
-
|
|
270
|
+
# W3C Trace Context via clientContext (placeholder for backend propagation support).
|
|
271
|
+
InvocationOtelPlugin(OtelPluginConfig(context_extractor=w3c_client_context_extractor))
|
|
231
272
|
```
|
|
232
273
|
|
|
274
|
+
Custom extractors should return `ExtractedContext`, not an OpenTelemetry
|
|
275
|
+
`Context`.
|
|
276
|
+
|
|
277
|
+
### Trace Structure
|
|
278
|
+
|
|
279
|
+
Both bundled plugins use the same execution ancestor:
|
|
280
|
+
|
|
281
|
+
- a propagated backend parent when `_X_AMZN_TRACE_ID` contains a valid `Root`
|
|
282
|
+
and `Parent`
|
|
283
|
+
- otherwise a deterministic, non-recording synthetic root derived from the
|
|
284
|
+
durable execution ARN
|
|
285
|
+
|
|
286
|
+
`InvocationOtelPlugin` keeps durable operation spans under the Invocation span
|
|
287
|
+
and links operations to Workflow:
|
|
288
|
+
|
|
289
|
+
```text
|
|
290
|
+
Execution ancestor
|
|
291
|
+
├── Workflow
|
|
292
|
+
└── Invocation
|
|
293
|
+
└── operation
|
|
294
|
+
└── operation attempt 1
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
`ExecutionOtelPlugin` keeps operation spans under Workflow and links operations
|
|
298
|
+
to the current Invocation span:
|
|
299
|
+
|
|
300
|
+
```text
|
|
301
|
+
Execution ancestor
|
|
302
|
+
├── Workflow
|
|
303
|
+
│ └── operation
|
|
304
|
+
│ └── operation attempt 1
|
|
305
|
+
└── Invocation
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
If an ambient Lambda span is active and already has the execution trace ID, the
|
|
309
|
+
Invocation span uses that ambient span as its parent. Ambient spans on a
|
|
310
|
+
different trace are ignored for durable parenting so Invocation remains on the
|
|
311
|
+
execution trace.
|
|
312
|
+
|
|
313
|
+
### Sampling
|
|
314
|
+
|
|
315
|
+
Sampling is resolved once per invocation and carried to every durable span in
|
|
316
|
+
that invocation. Precedence is:
|
|
317
|
+
|
|
318
|
+
1. `Sampled=1` or `Sampled=0` from `_X_AMZN_TRACE_ID`
|
|
319
|
+
2. a same-trace ambient span's recording/sampled state
|
|
320
|
+
3. the configured OpenTelemetry sampler
|
|
321
|
+
|
|
322
|
+
The resolved decision is applied to Workflow, Invocation, operation, and attempt
|
|
323
|
+
spans. This avoids independently querying stateful or ratio-based samplers for
|
|
324
|
+
each durable span in the same invocation.
|
|
325
|
+
|
|
233
326
|
### Log Correlation
|
|
234
327
|
|
|
235
328
|
When `enrich_logger=True` (the default), the plugin installs a logging filter on
|
|
@@ -249,8 +342,9 @@ After deploying your function with the plugin configured:
|
|
|
249
342
|
|
|
250
343
|
1. **Invoke your durable function** — trigger at least one execution that includes multiple steps or a wait/resume cycle.
|
|
251
344
|
|
|
252
|
-
2. **Check the CloudWatch console** — Navigate to CloudWatch → Traces in the AWS Console. You should see
|
|
253
|
-
-
|
|
345
|
+
2. **Check the CloudWatch console** — Navigate to CloudWatch → Traces in the AWS Console. You should see an execution trace with:
|
|
346
|
+
- A "Workflow" span exported on the terminal invocation
|
|
347
|
+
- An "Invocation" span per invocation
|
|
254
348
|
- Child spans for each durable operation (named after your step names)
|
|
255
349
|
- All invocations of the same execution grouped under one trace ID
|
|
256
350
|
|
|
@@ -265,40 +359,60 @@ After deploying your function with the plugin configured:
|
|
|
265
359
|
| Symptom | Likely Cause |
|
|
266
360
|
| --------------------------------- | --------------------------------------------------------------- |
|
|
267
361
|
| No traces appear | ADOT layer not configured, or `AWS_LAMBDA_EXEC_WRAPPER` not set |
|
|
268
|
-
| Traces appear but are fragmented |
|
|
362
|
+
| Traces appear but are fragmented | Backend trace context is not propagated to every invocation |
|
|
269
363
|
| Missing spans for some operations | `OTEL_TRACES_SAMPLER_ARG` set below 1.0 |
|
|
270
364
|
| `_X_AMZN_TRACE_ID` not populated | X-Ray active tracing not enabled |
|
|
271
365
|
|
|
272
366
|
## API Reference
|
|
273
367
|
|
|
274
|
-
### `
|
|
368
|
+
### `InvocationOtelPlugin`
|
|
275
369
|
|
|
276
|
-
|
|
370
|
+
Invocation-rooted view. Implements `DurableInstrumentationPlugin` from `aws_durable_execution_sdk_python`.
|
|
277
371
|
|
|
278
372
|
```python
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
373
|
+
InvocationOtelPlugin(
|
|
374
|
+
OtelPluginConfig(
|
|
375
|
+
tracer_provider=None,
|
|
376
|
+
context_extractor=None,
|
|
377
|
+
instrument_name="aws-durable-execution-sdk-python",
|
|
378
|
+
enrich_logger=True,
|
|
379
|
+
workflow_span_name="Workflow",
|
|
380
|
+
)
|
|
284
381
|
)
|
|
285
382
|
```
|
|
286
383
|
|
|
384
|
+
Pass `tracer_provider=...` when the application owns the OpenTelemetry SDK
|
|
385
|
+
provider. When omitted, the globally configured provider is used.
|
|
386
|
+
|
|
387
|
+
### `ExecutionOtelPlugin`
|
|
388
|
+
|
|
389
|
+
Execution-rooted view. Uses the same execution ancestor and sampling behavior as
|
|
390
|
+
`InvocationOtelPlugin`, but parents operation spans under Workflow and links
|
|
391
|
+
them to Invocation.
|
|
392
|
+
|
|
287
393
|
### `DeterministicIdGenerator`
|
|
288
394
|
|
|
289
395
|
A custom OpenTelemetry `IdGenerator` that produces reproducible trace and span IDs from execution metadata. Exported for advanced use cases.
|
|
290
396
|
|
|
291
397
|
### `xray_context_extractor`
|
|
292
398
|
|
|
293
|
-
Default context extractor. Reads the `_X_AMZN_TRACE_ID` environment variable
|
|
399
|
+
Default context extractor. Reads the `_X_AMZN_TRACE_ID` environment variable and
|
|
400
|
+
returns `ExtractedContext` containing parsed `Root`, `Parent`, and `Sampled`
|
|
401
|
+
fields when present.
|
|
294
402
|
|
|
295
403
|
### `w3c_client_context_extractor`
|
|
296
404
|
|
|
297
|
-
Alternative context extractor.
|
|
405
|
+
Alternative context extractor placeholder. Returns `None` until backend W3C
|
|
406
|
+
`traceparent` propagation is supported.
|
|
298
407
|
|
|
299
408
|
### `ContextExtractor`
|
|
300
409
|
|
|
301
|
-
Type alias for custom context extractor functions
|
|
410
|
+
Type alias for custom context extractor functions:
|
|
411
|
+
`Callable[[InvocationStartInfo], ExtractedContext | None]`.
|
|
412
|
+
|
|
413
|
+
### `ExtractedContext` / `Sampling`
|
|
414
|
+
|
|
415
|
+
Structured trace context and sampling decision returned by context extractors.
|
|
302
416
|
|
|
303
417
|
### `OtelContextLogFilter` / `install_log_filter`
|
|
304
418
|
|
|
@@ -309,9 +423,8 @@ setups.
|
|
|
309
423
|
## Requirements
|
|
310
424
|
|
|
311
425
|
- Python >= 3.11
|
|
312
|
-
- `aws-durable-execution-sdk-python` >=
|
|
313
|
-
- `
|
|
314
|
-
- `opentelemetry-sdk` >= 1.20.0
|
|
426
|
+
- `aws-durable-execution-sdk-python` >= 2.0.0
|
|
427
|
+
- An ADOT/community OpenTelemetry Lambda layer, or the `standalone` extra
|
|
315
428
|
|
|
316
429
|
## License
|
|
317
430
|
|