Skip to content

Update README.md #1748

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

Merged
merged 5 commits into from
Apr 4, 2025
Merged
Changes from all commits
Commits
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
58 changes: 55 additions & 3 deletions nodejs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,61 @@ the `AWS_LAMBDA_EXEC_WRAPPER` environment variable will initialize OpenTelemetry

To use, add the layer to your function configuration and then set `AWS_LAMBDA_EXEC_WRAPPER` to `/opt/otel-handler`.

[AWS SDK v2 instrumentation](https://github.com/aspecto-io/opentelemetry-ext-js/tree/master/packages/instrumentation-aws-sdk) is also
included and loaded automatically if you use the AWS SDK v2.
## Configuring auto instrumentation

[AWS SDK v3 instrumentation](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-aws-sdk)
is included and loaded automatically by default.
A subset of instrumentations from the [OTEL auto-instrumentations-node metapackage](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/metapackages/auto-instrumentations-node)
are also included.

Following instrumentations from the metapackage are included:
- `amqplib`
- `bunyan`
- `cassandra-driver`
- `connect`
- `dataloader`
- `dns` *- default*
- `express` *- default*
- `fs`
- `graphql` *- default*
- `grpc` *- default*
- `hapi` *- default*
- `http` *- default*
- `ioredis` *- default*
- `kafkajs`
- `knex`
- `koa` *- default*
- `memcached`
- `mongodb` *- default*
- `mongoose`
- `mysql` *- default*
- `mysql2`
- `nestjs-core`
- `net` *- default*
- `pg` *- default*
- `pino`
- `redis` *- default*
- `restify`
- `socket.io`
- `undici`
- `winston`

Instrumentations annotated with "*- default*" are loaded by default.

To only load specific instrumentations, specify the `OTEL_NODE_ENABLED_INSTRUMENTATIONS` environment variable in the lambda configuration.
This disables all the defaults, and only enables the ones you specify. Selectively disabling instrumentations from the defaults is also possible with the `OTEL_NODE_DISABLED_INSTRUMENTATIONS` environment variable.

The environment variables should be set to a comma-separated list of the instrumentation package names without the
`@opentelemetry/instrumentation-` prefix.

For example, to enable only `@opentelemetry/instrumentation-http` and `@opentelemetry/instrumentation-undici`:
```shell
OTEL_NODE_ENABLED_INSTRUMENTATIONS="http,undici"
```
To disable only `@opentelemetry/instrumentation-net`:
```shell
OTEL_NODE_DISABLED_INSTRUMENTATIONS="net"
```

## Building

Expand All @@ -31,5 +84,4 @@ You'll find the generated layer zip file at `./packages/layer/build/layer.zip`.
Sample applications are provided to show usage of the above layer.

- Application using AWS SDK - shows using the wrapper with an application using AWS SDK without code change.
- [Using layer built from source](./integration-tests/aws-sdk)
- [WIP] [Using OTel Public Layer](./sample-apps/aws-sdk)