Skip to content

Commit 30ef366

Browse files
authored
Update aws lambda spec to remove X-Ray Env propagation (open-telemetry#3166)
* Update aws lambda spec to remove X-Ray Env propagation Per discussion in the FAAS SIG, we decided that the aws x-ray environment variable should be moved to a span link to avoid interfering with the configured propagators.
1 parent 1781e92 commit 30ef366

File tree

1 file changed

+10
-13
lines changed
  • specification/trace/semantic_conventions/instrumentation

1 file changed

+10
-13
lines changed

specification/trace/semantic_conventions/instrumentation/aws-lambda.md

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use cases.
1414
<!-- toc -->
1515

1616
- [All triggers](#all-triggers)
17-
* [Determining the parent of a span](#determining-the-parent-of-a-span)
17+
* [AWS X-Ray Environment Span Link](#aws-x-ray-environment-span-link)
1818
- [API Gateway](#api-gateway)
1919
- [SQS](#sqs)
2020
* [SQS Event](#sqs-event)
@@ -61,22 +61,19 @@ and the [cloud resource conventions][cloud]. The following AWS Lambda-specific a
6161
[faasres]: ../../../resource/semantic_conventions/faas.md (FaaS resource conventions)
6262
[cloud]: ../../../resource/semantic_conventions/cloud.md (Cloud resource conventions)
6363

64-
### Determining the parent of a span
64+
### AWS X-Ray Environment Span Link
6565

66-
The parent of the span MUST be determined by considering both the environment and any headers or attributes
67-
available from the event.
68-
69-
If the `_X_AMZN_TRACE_ID` environment variable is set, instrumentations SHOULD first try to parse an
66+
If the `_X_AMZN_TRACE_ID` environment variable is set, instrumentation SHOULD try to parse an
7067
OpenTelemetry `Context` out of it using the [AWS X-Ray Propagator](../../../context/api-propagators.md). If the
71-
resulting `Context` is [valid](../../api.md#isvalid) and sampled, then this `Context` is the parent of the
72-
function span. We check if it is valid because sometimes the `_X_AMZN_TRACE_ID` environment variable contains
73-
an incomplete trace context which indicates X-Ray isn’t enabled. The environment variable will be set and the
68+
resulting `Context` is [valid](../../api.md#isvalid) then a [Span Link][] SHOULD be added to the new Span's
69+
[start options](../../api.md#specifying-links) with an associated attribute of `source=x-ray-env` to
70+
indicate the source of the linked span.
71+
Instrumentation MUST check if the context is valid before using it because the `_X_AMZN_TRACE_ID` environment variable can
72+
contain an incomplete trace context which indicates X-Ray isn’t enabled. The environment variable will be set and the
7473
`Context` will be valid and sampled only if AWS X-Ray has been enabled for the Lambda function. A user can
75-
disable AWS X-Ray for the function if X-Ray propagation is not desired.
74+
disable AWS X-Ray for the function if the X-Ray Span Link is not desired.
7675

77-
Otherwise, when X-Ray propagation fails, the user's configured propagators SHOULD be applied to the HTTP
78-
headers of the request to extract a `Context`. For example, API Gateway proxy requests can be configured to
79-
send HTTP headers to a Lambda function using [a body mapping template](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-override-request-response-parameters.html).
76+
[Span Link]: https://opentelemetry.io/docs/concepts/signals/traces/#span-links
8077

8178
## API Gateway
8279

0 commit comments

Comments
 (0)