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

Feat: Add EventToCarrier to AWS Lambda semantic conventions #164

Closed
Closed
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
3aaa4cd
Feat: Add EventToCarrier to AWS Lambda semantic conventions
rapphil Jul 6, 2023
526dc65
Fix: fix TOC
rapphil Jul 6, 2023
ab15449
Fix: fix toc
rapphil Jul 6, 2023
8606301
Merge branch 'main' into rapphil-add-event-to-carrier
rapphil Jul 6, 2023
29fdde3
Update specification/faas/aws-lambda.md
rapphil Aug 14, 2023
71f4932
Moved resource semconv directly under the resource directory (#165)
AlexanderWert Jul 6, 2023
f4a5387
Renamed `specification` and `semantic_conventions` to `model` and `do…
AlexanderWert Jul 6, 2023
053fe9a
Fix path of md table generation make task (#173)
joaopgrassi Jul 7, 2023
86940d2
Add markdown file for url semantic conventions (#174)
ChrsMark Jul 7, 2023
c2b9767
[editorial] Add missing `README.md` for Resource Cloud Provider semco…
chalin Jul 7, 2023
02071de
[editorial] docs/rpc/json-rpc: fix title and in-page hypenation (#170)
chalin Jul 7, 2023
57bd011
[editorial] Rename docs files and folders: replace "_" by "-"; add ch…
chalin Jul 7, 2023
c35b1d4
Fix semantic-conventions README.md file links (#168)
YANG-DB Jul 7, 2023
aa85e62
[editorial] Fix doc page titles and add Hugo front matter (#175)
chalin Jul 7, 2023
31ca6ef
[editorial] Link directly to page, not to page's title (#180)
chalin Jul 7, 2023
f875722
Bump to latest version of the specification. (#185)
jsuereth Jul 12, 2023
5200be9
[CI] Report link-check error when external URL used for local doc pag…
chalin Jul 13, 2023
69f6bae
Update documentation for how to cut a release AND perform the action …
jsuereth Jul 13, 2023
12bd6b0
[editorial] markdownlint in less then 1.5 sec (#193)
chalin Jul 14, 2023
b7e10e6
[editorial] Rename general section pages by dropping `general` from t…
chalin Jul 14, 2023
89e1603
[editorial] Setup Prettier and run it on some files (#192)
chalin Jul 21, 2023
c31e03c
Editorial: Remove overlooked messaging.source attributes from aws lam…
lmolkova Jul 21, 2023
de2cf45
Fix the unit of metric.process.runtime.jvm.system.cpu.load_1m to be {…
zeitlinger Jul 21, 2023
be82642
Change company affiliation for Johannes (#207)
pyohannes Jul 25, 2023
fe818fd
`.count` metric naming convention only applies to UpDownCounters (#107)
trask Jul 25, 2023
97e92be
[editorial][CI] Ensure markdownlint has proper exit status (#210)
chalin Jul 27, 2023
c4b58a4
Update contributing documentation for restructuring of repository (#216)
jsuereth Jul 28, 2023
a46db0f
Re-enable the schema check to look at the website. (#217)
jsuereth Jul 28, 2023
1c4e58f
Add Alexander Wert as an Approver (#220)
reyang Aug 1, 2023
ff064a4
Bump semantic conventions tooling to v0.20.0 (#225)
arminru Aug 1, 2023
0cf0e8d
Add system.cpu.physical.count and system.cpu.logical.count metrics (#99)
frzifus Aug 1, 2023
740ebd6
Add PR template (#223)
reyang Aug 1, 2023
6561f68
Generate database metrics semconv from YAML (#90)
joaopgrassi Aug 1, 2023
a491f82
Generate RPC metrics from YAML (#93)
joaopgrassi Aug 2, 2023
790eac9
Rename `http.*.duration` to `http.*.request.duration` (#224)
lmolkova Aug 3, 2023
2f4d8b4
HTTP version should be 2 and 3 instead of 2.0 and 3.0 (#228)
lmolkova Aug 6, 2023
94b653e
Generate FaaS metrics semconv from YAML (#88)
joaopgrassi Aug 7, 2023
8dfd92c
Re-introduce namespace to describe the original destination (#156)
joaopgrassi Aug 7, 2023
50cf594
Move Joao Grassi from approver to maintainer (#239)
reyang Aug 8, 2023
d550c98
Update destination attribute briefs (#243)
trask Aug 10, 2023
a6c3202
Rename all JVM metrics from process.runtime.jvm.* to jvm.* (#241)
trask Aug 10, 2023
92ad618
Fix: fix TOC
rapphil Jul 6, 2023
1d3b5ca
Fix: fix toc
rapphil Jul 6, 2023
58c722c
Update EvenToCarrier based on feedback
rapphil Aug 14, 2023
7fd5a23
Merge branch 'main' into rapphil-add-event-to-carrier
rapphil Aug 14, 2023
94a3bf5
Update to simplify language
rapphil Sep 11, 2023
6dd68fe
Merge branch 'main' into rapphil-add-event-to-carrier
rapphil Sep 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 24 additions & 13 deletions docs/faas/aws-lambda.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ use cases.
<!-- toc -->

- [All triggers](#all-triggers)
* [AWS X-Ray Environment Span Link](#aws-x-ray-environment-span-link)
* [Determining the remote parent span context](#determining-the-remote-parent-span-context)
+ [EventToCarrier in auto-instrumentation](#eventtocarrier-in-auto-instrumentation)
- [API Gateway](#api-gateway)
- [SQS](#sqs)
* [SQS Event](#sqs-event)
Expand Down Expand Up @@ -54,21 +55,31 @@ and the [cloud resource conventions][cloud]. The following AWS Lambda-specific a
[faasres]: /docs/resource/faas.md (FaaS resource conventions)
[cloud]: /docs/resource/cloud.md (Cloud resource conventions)

### AWS X-Ray Environment Span Link
### Determining the remote parent span context

If the `_X_AMZN_TRACE_ID` environment variable is set, instrumentation SHOULD try to parse an
OpenTelemetry `Context` out of it using the [AWS X-Ray Propagator](https://github.com/open-telemetry/opentelemetry-specification/tree/v1.22.0/specification/context/api-propagators.md). If the
resulting `Context` is [valid](https://github.com/open-telemetry/opentelemetry-specification/tree/v1.22.0/specification/trace/api.md#isvalid) then a [Span Link][] SHOULD be added to the new Span's
[start options](https://github.com/open-telemetry/opentelemetry-specification/tree/v1.22.0/specification/trace/api.md#specifying-links) with an associated attribute of `source=x-ray-env` to
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 the X-Ray Span Link is not desired.
Lambda does not have HTTP headers to read from and instead stores the headers it was invoked with (including any propagated context, etc.) as part of the invocation event. If using AWS X-Ray tracing then the trace context is instead stored in the Lambda environment. It is also possible that both options are populated at the same time, with different values. Finally it is also possible to propagate tracing information in a SQS message using the system attribute of the message `AWSTraceHeader`.

**Note**: When instrumenting a Java AWS Lambda, instrumentation SHOULD first try to parse an OpenTelemetry `Context` out of the system property `com.amazonaws.xray.traceHeader` using the [AWS X-Ray Propagator](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/context/api-propagators.md) before checking and attempting to parse the environment variable above.
The lambda instrumentation MUST use a `EventToCarrier` to prepare a `Carrier` to be used by subsequent `TextMapPropagators`.

[Span Link]: https://opentelemetry.io/docs/concepts/signals/traces/#span-links
A `EventToCarrier` MUST implement the `Convert` operation to convert a lambda `Event` into a `Carrier`.

The `Convert` operation MUST return a `Carrier` and MUST have the following parameters:
`Event` - the lambda event.

The `EventToCarrier` used in the lambda instrumentation SHOULD be provided as a parameter during the initialization of this
instrumentation. This parameter MAY be provided by users that provide a implementation for the `EventToCarrier`.

Lambda instrumentation MUST provide a default `EventToCarrier`, the `HttpEventToCarrier`, which populates the `Carrier` with the content of the http headers used to invoke the lambda function, when that is available.

If no `EventToCarrier` is provided during the initialization of the lambda instrumentation, the `HttpEventToCarrier` MUST be used.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't take @Oberon00's feedback into account. As written, it seems that SQS lambda's will require explicit config to select the proper EventToCarrier implementation. This should not be required of users.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, is there anything in the proposal blocking the implementation of a EventToCarrier that is supposed to work with SQS? I don't think we need to list all possible cases and how they should be implemented, do we?

The important thing is that the lambda instrumentation can receive an EventToCarrier as parameter.

Listing cases that COULD be supported was a source of confusion in the previous revision of this proposal.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is not missing cases, but that the user should not need to configure this explicitly. The implementation should automatically extract without the user configuring the trigger type explicitly.


**NOTE**: When instrumenting a Java AWS Lambda with an `EventToCarrier` that extracts the event from the lambda environment, this `EventToCarrier` SHOULD first try to parse the `X-Amzn-Trace-Id` out of the system property `com.amazonaws.xray.traceHeader` before checking and attempting to parse the environment variable `_X_AMZN_TRACE_ID`.

#### EventToCarrier in auto-instrumentation

In languages that support auto-instrumentation, the `EventToCarrier` used in the lambda instrumentation MAY be configured using the environment variable `OTEL_AWS_LAMBDA_EVENT_TO_CARRIER`. This environment variable MUST be set to the name of the `EventToCarrier` that will be used.

The `HttpEventToCarrier` has name `http-headers`.

## API Gateway

Expand Down
Loading