Repository navigation
Conversation
A runnable Express.js zip example that traces through AWS Distro for OpenTelemetry while keeping the adapter's /opt/bootstrap exec wrapper, as promised in #568. - run.sh loads @aws/aws-distro-opentelemetry-node-autoinstrumentation through NODE_OPTIONS (shipped in node_modules, no bundler) and sets OTEL_SERVICE_NAME. Metrics and logs exporters default to none: in Lambda the SDK exports traces over UDP to the X-Ray endpoint and there is no OTLP collector for the other signals. - template.yaml attaches the adapter layer and the ADOT Node.js layer (AdotLayerArn parameter: account and version differ by Region), with Tracing: Active (SAM adds AWSXrayWriteOnlyAccess). - Registered in .github/dependabot.yml, README.md and the docs examples overview. Refs #568
The ADOT package ships in node_modules and, inside Lambda, exports traces over UDP straight to the function's X-Ray endpoint. Nothing loads the AWSOpenTelemetryDistroJs layer: its only entry point is the /opt/otel-instrument exec wrapper, and that slot belongs to the adapter's /opt/bootstrap. Remove the layer and the region-specific AdotLayerArn parameter, and say in the README that no ADOT layer is needed. The metrics/logs exporter defaults stay. Refs #568
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #568
In #568 we promised a runnable example of tracing a Lambda Web Adapter app with AWS Distro for OpenTelemetry. This adds
examples/expressjs-otel-zip, based onexpressjs-zip.The adapter keeps the exec wrapper: a function gets one
AWS_LAMBDA_EXEC_WRAPPER, and it must stay/opt/bootstrap. So OpenTelemetry is loaded fromrun.shinstead:node_modules(no bundler, because it patcheshttp/expresswhen they are required). Inside Lambda it sends traces over UDP straight to the function's X-Ray endpoint. The ADOT Lambda layer only adds an/opt/otel-instrumentexec wrapper, which can't run next to the adapter's, so the example attaches just the adapter layer. The layer used in the original LWA + OpenTelemetry collector + zip Lambda deployment - is it possible? #568 thread is the legacy collector layer, which is now deprecated.Tracing: Active; SAM addsAWSXrayWriteOnlyAccess..github/dependabot.yml, the README examples list and the docs overview. It isn't in the CI boot matrix.Testing:
sam validate --lintpasses for all 47 templates andcheck-example-config.shpasses.npm ciandnode --checkpass. A local run (bound to 127.0.0.1, Lambda-like environment, a UDP listener in place of the X-Ray endpoint) returnsHi there!, and the exported trace hasGET /plus express middleware andrequest handler - /spans underservice.name=expressjs-otel. It hasn't been deployed to Lambda yet.Known:
npm auditreports 13 advisories (4 high, 9 moderate), all transitive through ADOT 0.13.0, the current release. The Dependabot entry will pick up the fix when ADOT releases it.