aws-cdk-lib.aws_lambda.Tracing

enum Tracing

LanguageType name
.NETAmazon.CDK.AWS.Lambda.Tracing
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awslambda#Tracing
Javasoftware.amazon.awscdk.services.lambda.Tracing
Pythonaws_cdk.aws_lambda.Tracing
TypeScript (source)aws-cdk-lib » aws_lambda » Tracing

X-Ray Tracing Modes (https://docs.aws.amazon.com/lambda/latest/dg/API_TracingConfig.html).

Example

const fn = new lambda.Function(this, 'MyFunction', {
  runtime: lambda.Runtime.NODEJS_18_X,
  handler: 'index.handler',
  code: lambda.Code.fromInline('exports.handler = function(event, ctx, cb) { return cb(null, "hi"); }'),
  tracing: lambda.Tracing.ACTIVE,
});

Members

NameDescription
ACTIVELambda will respect any tracing header it receives from an upstream service.
PASS_THROUGHLambda will only trace the request from an upstream service if it contains a tracing header with "sampled=1".
DISABLEDLambda will not trace any request.

ACTIVE

Lambda will respect any tracing header it receives from an upstream service.

If no tracing header is received, Lambda will sample the request based on a fixed rate. Please see the Using AWS Lambda with AWS X-Ray documentation for details on this sampling behavior.


PASS_THROUGH

Lambda will only trace the request from an upstream service if it contains a tracing header with "sampled=1".


DISABLED

Lambda will not trace any request.