Try it free

Set up OpenTelemetry monitoring for Azure Functions on Consumption Plan

  • How-to guide
  • 3-min read

Dynatrace version 1.240+ OneAgent version 1.193+

Dynatrace uses OpenTelemetry to monitor Azure Functions invocations. For that purpose, Dynatrace provides language-specific packages, such as Dynatrace.OpenTelemetry.Instrumentation.AzureFunctions.Core for .NET, that can be used in combination with default OpenTelemetry SDKs and APIs.

Installation

Step 1

Activate the OneAgent feature

Step 2

Select a configuration method

Step 3 optional

Specify a Dynatrace API endpoint

Step 4

Apply the configuration to your function app

Step 5

Instrument the function code

Step 1 Activate the OneAgent feature

Go to Settings > Preferences > OneAgent features and activate the Forward Tag 4 trace context extension OneAgent feature.

Step 2 Select a configuration method

  1. In Dynatrace, Search for Deploy OneAgent app and select it.
  2. Under Download Dynatrace OneAgent, select Set up > Azure Functions.
  3. On the Enable Monitoring for Azure Functions page, under How will you configure your Azure Functions?, select your preferred configuration method from the dropdown menu.

Step 3 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 Azure Function that you want to monitor.

Step 4 Apply the configuration to your function app

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 Azure Functions deployment.

On Enable Monitoring for Azure Functions, under Use the following values to configure your monitored Azure Functions, there's a snippet with all required environment variables. Be sure to add these environment variables and their values to your function app configuration:

  1. In Azure Portal, go to your function app.
  2. In Settings, select Configuration.
  3. Edit any existing environment variables so that the names and values match those in Dynatrace, or, if your function app doesn't have any existing variables, select New application setting and add the names and values for all the variables in Dynatrace.

Leave the settings not listed by Dynatrace unchanged.

Step 5 Instrument the function code

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

  • .NET (C#): Trace Azure Functions written in .NET
  • Node.js (Javascript): Trace Azure Functions written in Node.js
  • Python: Trace Azure Functions written in Python

Known limitations

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

Related topics

  • Monitor Azure Functions on App Service Plan for Windows
  • Set up Dynatrace on Microsoft Azure
  • OneAgent platform and capability support matrix
Related tags
Infrastructure ObservabilityAzure