# AdotInstrumentationConfig

Properties for an ADOT instrumentation in Lambda.

**Note:** This uses the legacy ADOT Lambda layers that bundle an embedded collector.
For the recommended optimized ADOT Lambda layers (the `AWSOpenTelemetryDistro*` family),
add the layer via `Function.addLayers()` and set the `AWS_LAMBDA_EXEC_WRAPPER`
environment variable to `/opt/otel-instrument` instead.

- Source: [`aws-lambda/lib/adot-layers.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-lambda/lib/adot-layers.ts#L95)
- Type last changed: v2.57.0 · 27 Dec 2022

## Example

```ts
import {
  AdotLambdaExecWrapper,
  AdotLayerVersion,
  AdotLambdaLayerJavaScriptSdkVersion,
} from 'aws-cdk-lib/aws-lambda';

const fn = new lambda.Function(this, 'MyFunction', {
  runtime: lambda.Runtime.NODEJS_LATEST,
  handler: 'index.handler',
  code: lambda.Code.fromInline('exports.handler = function(event, ctx, cb) { return cb(null, "hi"); }'),
  adotInstrumentation: {
    layerVersion: AdotLayerVersion.fromJavaScriptSdkLayerVersion(AdotLambdaLayerJavaScriptSdkVersion.LATEST),
    execWrapper: AdotLambdaExecWrapper.REGULAR_HANDLER,
  },
});
```

## Properties

- `execWrapper`: [AdotLambdaExecWrapper](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.AdotLambdaExecWrapper.html) (required) — The startup script to run, see ADOT documentation to pick the right script for your use case: https://aws-otel.github.io/docs/getting-started/lambda.

- `layerVersion`: [AdotLayerVersion](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.AdotLayerVersion.html) (required) — The ADOT Lambda layer.
