# OpenTelemetry for AWS Lambda

To automatically instrument your AWS Lambda functions with the Baselime OpenTelemetry tracer for AWS Lambda, set the following tag to your AWS Lambda functions: baselime:tracing=true.

This method for distributed tracing is available only for Node.js and Python runtimes on AWS Lambda.

AWS Lambda Tracing
AWS Lambda Tracing

To add the Baselime tag to all your AWS Lambda functions in a service or stack add this line to your AWS CDK code.

 Tags.of(app).add("baselime:tracing", `true`);

To add the Baselime tag to all your AWS Lambda functions in a service or stack add this line to your sst.config.ts file.

 Tags.of(app).add("baselime:tracing", `true`);

To add the Baselime tag to all your AWS Lambda functions in a add this snippet to your serverless.yml file.

provider:
  name: aws
  tags:
    "baselime:tracing": "true"

To add the Baselime tag to all your AWS Lambda functions in a add this snippet to your AWS SAM configuration file.

AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: "Gets data from the xxxxx API."
Globals:
  Function:
    Tags:
       "baselime:tracing": "true"

# Runtimes

Node.js
node.js/
Python
python/


# Remove OpenTelemetry Instrumentation

To remove the OpenTelemetry instrumentation from your AWS Lambda functions, remove the baselime:tracing=true tag from the function and Baselime will revert the function to un-instrumentate state.


# Sending data to another OpenTelemetry backend

OpenTelemetry is an open standard, and you can use the Baselime Node.js OpenTelemetry tracer for AWS Lambda to send telemetry data to another backend of your choice.

Set environment variable COLLECTOR_URL to your observability backend.