Skip to content

NodeJS: Add option to disable AWS Lambda auto instrumentation. #1803

Open
@pseiferth

Description

@pseiferth

Is your feature request related to a problem? Please describe.
I want to instrument a lambda function that processes a batch of SQS messages. Each SQS message contains a W3C tracing context in some custom fields and I extract them manually for each message and updating the Otel Context. Hence, I am not really interested in the span that is automatically created on each invocation of the Lambda. I would like to disable those, but there is no option to do so. Using the AWSLambdaInstrumentation seems to be hardcoded and not configurable via OTEL_NODE_ENABLED_INSTRUMENTATIONS / OTEL_NODE_DISABLED_INSTRUMENTATIONS. I still want to use the full NodeJS lambda layer since it handles all the remaining auto-instrumentation, initialization and flushing properly.

Describe the solution you'd like
Setting OTEL_NODE_DISABLED_INSTRUMENTATIONS="aws-lambda" should disable the AWS lambda auto instrumentation and not create a span for each invocation of the Lambda.

Describe alternatives you've considered
Not using the NodeJS layer, only the Otel Collector layer, and then initializing Opentelemetry manually. But this get quite tricky if you want to use auto instrumentation, especially with the aws-sdk and bundling everything using CDK.

Additional context
I think this might be the problem:

new AwsLambdaInstrumentation(

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions