Monitor AWS Lambda with OpenTelemetry

Dynatrace provides enhancements to OpenTelemetry for AWS Lambda such as exporters, additional instrumentation, and helper libraries to simplify the monitoring of AWS Lambda.

For a list of language-specific packages that you can use in combination with the native OpenTelemetry SDKs and APIs or AWS Distribution for OpenTelemetry, see Trace .NET Lambda functions.

Prerequisites

  • Dynatrace version 1.240+
  • OneAgent version 1.193+ for all OneAgents participating in a trace
  • In Dynatrace, go to Settings > Preferences > OneAgent features and activate the Forward Tag 4 trace context extension OneAgent feature.

Installation

Step 1 Set the monitoring solution and configuration method

Configuration options regarding Lambda layers don't apply here.

  1. In Dynatrace Hub, select AWS Lambda.

  2. Select Set up.

  3. On the Enable Monitoring for AWS Lambda Functions page, set Select a runtime to .NET.

    This automatically sets Monitoring solution to AWS Lambda OpenTelemetry package.

  4. Set Select a configuration method to your preferred configuration method. Make sure you set all properties for the chosen configuration method.

Step 2 optional Specify a Dynatrace API endpoint optional

If you don't want to use the default public Dynatrace endpoint, specify a custom Dynatrace API endpoint where you want to receive monitoring data.

To reduce network latency, you typically deploy a Dynatrace ActiveGate close to (in the same region as) the AWS Lambda function that you want to monitor.

Step 3 Apply the configuration to your AWS Lambda function

To apply the configuration, select one of the options below, depending on your configuration method.

Copy the JSON snippet into a file named dtconfig.json located in the root folder of your AWS Lambda Functions deployment.

On Enable Monitoring for AWS Lambda Functions, under Use the following values to define environment variables for your AWS Lambda function, there's a snippet with all required environment variables. Be sure to add these environment variables and their values to your Lambda function configuration. For details, see Configuring environment variables.

Step 4 Instrument the function code

Adding the required API calls to monitor function invocations via OpenTelemetry is specific to languages and their respective OpenTelemetry distribution.

To get detailed instructions for different languages supported by Dynatrace, see Trace .NET Lambda functions.

Known limitations

The Dynatrace instrumentation doesn't capture the IP addresses of outgoing HTTP requests. If the called service isn't monitored with Dynatrace, this results in unmonitored hosts.