Tracing

class aws_cdk.aws_lambda.Tracing(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

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

ExampleMetadata:

infused

Example:

fn = lambda_.Function(self, "MyFunction",
    runtime=lambda_.Runtime.NODEJS_18_X,
    handler="index.handler",
    code=lambda_.Code.from_inline("exports.handler = function(event, ctx, cb) { return cb(null, "hi"); }"),
    tracing=lambda_.Tracing.ACTIVE
)

Attributes

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.

DISABLED

Lambda will not trace any request.

PASS_THROUGH

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