This page explains how to collect traces, trace metrics, runtime metrics, and custom metrics from your Azure Functions. To collect additional metrics, install the Datadog Azure integration.
Datadog recommends pinning the package versions and regularly upgrading to the latest versions of both @datadog/serverless-compat and dd-trace to ensure you have access to enhancements and bug fixes.
Start the Datadog serverless compatibility layer and initialize the Node.js tracer. Add the following lines to your main application entry point file (for example, app.js):
require('@datadog/serverless-compat').start();// This line must come before importing any instrumented module.
consttracer=require('dd-trace').init()
Datadog recommends regularly upgrading to the latest versions of both dd-serverless-compat-java-agent and dd-java-agent to ensure you have access to enhancements and bug fixes.
Start the Datadog serverless compatibility layer and initialize the Java tracer. Add the following -javaagent arguments to the JVM options.:
Note: the environment variable to set JVM options depends on the hosting plan (example, Consumption, Elastic Premium, Dedicated). See Azure Functions Java developer guide for more details on the appropriate environment variable for your hosting plan.
Configure Unified Service Tagging. You can collect metrics from your Azure Functions by installing the Datadog Azure integration. To correlate these metrics with your traces, first set the env, service, and version tags on your resource in Azure. Then, configure the following environment variables. You can add custom tags as DD_TAGS.
You can view your Azure Functions traces in Trace Explorer. Search for the service name you set in the DD_SERVICE environment variable to see your traces.