Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update aws lambda spec to remove X-Ray Env propagation #3166

Merged
merged 11 commits into from
Feb 10, 2023
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ release.

### Semantic Conventions

- Move X-Ray Env Variable propagation to span link instead of parent for AWS Lambda.
([#3166](https://github.com/open-telemetry/opentelemetry-specification/pull/3166))

### Compatibility

### OpenTelemetry Protocol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use cases.
<!-- toc -->

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

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

The parent of the span MUST be determined by considering both the environment and any headers or attributes
available from the event.

If the `_X_AMZN_TRACE_ID` environment variable is set, instrumentations SHOULD first try to parse an
If the `_X_AMZN_TRACE_ID` environment variable is set, instrumentation SHOULD try to parse an
carlosalberto marked this conversation as resolved.
Show resolved Hide resolved
OpenTelemetry `Context` out of it using the [AWS X-Ray Propagator](../../../context/api-propagators.md). If the
resulting `Context` is [valid](../../api.md#isvalid) and sampled, then this `Context` is the parent of the
function span. We check if it is valid because sometimes the `_X_AMZN_TRACE_ID` environment variable contains
an incomplete trace context which indicates X-Ray isn’t enabled. The environment variable will be set and the
resulting `Context` is [valid](../../api.md#isvalid) then a [Span Link][] SHOULD be added to the new Span's
[start options](../../api.md#specifying-links) with an associated attribute of `source=x-ray-env` to
tylerbenson marked this conversation as resolved.
Show resolved Hide resolved
indicate the source of the linked span.
Instrumentation MUST check if the context is valid before using it because the `_X_AMZN_TRACE_ID` environment variable can
contain an incomplete trace context which indicates X-Ray isn’t enabled. The environment variable will be set and the
`Context` will be valid and sampled only if AWS X-Ray has been enabled for the Lambda function. A user can
disable AWS X-Ray for the function if X-Ray propagation is not desired.
disable AWS X-Ray for the function if the X-Ray Span Link is not desired.

Otherwise, when X-Ray propagation fails, the user's configured propagators SHOULD be applied to the HTTP
headers of the request to extract a `Context`. For example, API Gateway proxy requests can be configured to
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).
[Span Link]: https://opentelemetry.io/docs/concepts/signals/traces/#span-links

## API Gateway

Expand Down