Skip to content
v2.274.0

AdotInstrumentationConfig Struct ​

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.

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 ​

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.
layerVersionAdotLayerVersionlayer_versionAdotLayerVersionlayerVersionAdotLayerVersionLayerVersionAdotLayerVersionLayerVersionAdotLayerVersionrequired#
The ADOT Lambda layer.