Upgrade Instrumentation for Java Lambda Functions

This document contains instructions for upgrading your Datadog for Java Lambda instrumentation. If you are setting up instrumentation for the first time, follow the Java Lambda installation instructions instead.

Datadog Lambda layers dd-trace-java:5 and Datadog-Extension:25 introduce the following changes to the process of setting up instrumentation on Java Lambda functions:

  1. The datadog-lambda-java library is deprecated and not required.
  2. No code changes (such as the DDLambda wrapper) are required, except for custom instrumentation.
  3. You can set up Datadog using the Datadog CI and the Datadog Serverless Plugin.

Upgrade

  1. Remove datadog-lambda-java from build.gradle or pom.xml, as it is no longer required.
  2. Remove DDLambda and the import statement from your function code.
  3. Set environment variable AWS_LAMBDA_EXEC_WRAPPER to /opt/datadog_wrapper.
  4. Increment the dd-trace-java version to 15 and Datadog-Extension to 65.
  5. If you are submitting custom metrics using the DDLambda.metric() helper function, use the standard DogStatsD client for Java and follow the sample code to submit a metric as a distribution. Note that in Lambda, you can only use distributions.