Esta página aún no está disponible en español. Estamos trabajando en su traducción.
Si tienes alguna pregunta o comentario sobre nuestro actual proyecto de traducción, no dudes en ponerte en contacto con nosotros.

Supported runtimes: Node.js, Python

You can use remote instrumentation to quickly add instrumentation to your AWS Lambda functions and keep them instrumented securely.

The instrumenter is a Lambda function that ensures your target functions have the Datadog Lambda extension and Datadog Lambda library added. The instrumenter also ensures that your functions remain instrumented and can send telemetry to Datadog.

The instrumenter must be deployed to every region and account where you want to instrument functions.

Prerequisites

Setup

  1. On the Serverless > AWS Lambda page, select Instrument Functions.

  2. On the Select AWS Region and Launch CloudFormation modal:

    • Click Select API Key to select the Datadog API key to use to send data to your AWS account.
    • Use the Select a region drop-down to choose the region where you want to enable instrumentation.
  3. Click Launch CloudFormation Template. You are prompted to deploy the template into your environment. Launching the template can take a few minutes.

    Datadog recommends that you always test remote instrumentation on development functions before moving to staging and production.

    The CloudFormation stack deploys the instrumenter function, datadog-remote-instrumenter, into your account and region. The stack also creates a CloudTrail and some adjacent resources.

  4. After the instrumenter function is deployed, select functions to instrument. You can select functions by tag or by function name. To enable instrumentation for multiple functions at once, you could apply a custom tag (for example, dd_serverless_instrument:true) to all the functions you want to instrument, and use this tag to select all of your desired functions. Tag matching is case-insensitive.

    After you finish your selections, click Enable Remote Instrumentation.

  5. Confirm your function selections. You can also set layer versions and toggle logging and tracing. These settings are used for all future instrumentation and remain fixed until you manually update them. Updates can take a few minutes to be applied.

Skipped functions

Functions that have pre-existing Datadog layers or environment variables are considered manually instrumented. Manually instrumented functions are marked manual and skipped by the remote instrumenter to ensure there are no layer conflicts.

Datadog recommends that you only instrument Lambda functions with a memory size greater than 256 MB. To skip instrumenting smaller Lambdas, make sure they are not selected.

Verification

To confirm that your functions are instrumented with Datadog, open your AWS Console and ensure that two layers (Datadog Lambda extension and datadog-lambda-python or datadog-lambda-js) have been added to each selected function.

Removing instrumentation

Deleting the CloudFormation stack in a region automatically removes instrumentation from all functions in that region.

Troubleshooting

If you see issues related to IAM roles, ensure that you have permission to create resources for the following services:

  • EventBridge
  • S3
  • CloudTrail
  • Lambda