Install Serverless Monitoring for Azure Functions

このページは日本語には対応しておりません。随時翻訳に取り組んでいます。
翻訳に関してご質問やご意見ございましたら、お気軽にご連絡ください

Overview

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.

Setup

  1. Install dependencies. Download the Datadog JARs and deploy them with your function:

    wget -O dd-java-agent.jar 'https://dtdg.co/latest-java-tracer'
    wget -O dd-serverless-compat-java-agent.jar 'https://dtdg.co/latest-serverless-compat-java-agent'
    

    See Datadog’s Maven Repository for any specific version of the Datadog Serverless Compatibility Layer.

    To use automatic instrumentation, you must use dd-java-agent v1.48.0+.

    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.

  2. Start the Datadog serverless compatibility layer and initialize the Java tracer. Add the following -javaagent arguments to the JVM options.:

    -javaagent:/path/to/dd-serverless-compat-java-agent.jar -javaagent:/path/to/dd-java-agent.jar
    

    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.

  3. (Optional) Enable runtime metrics. See Java Runtime Metrics.

  4. (Optional) Enable custom metrics. See Metric Submission: DogStatsD.

  1. Deploy your function.

  2. Configure Datadog intake. Add the following environment variables to your function’s application settings:

    NameValue
    DD_API_KEYYour Datadog API key.
    DD_SITEYour Datadog site. For example, datadoghq.com.
  3. 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.

    NameValue
    DD_ENVHow you want to tag your env for Unified Service Tagging. For example, prod.
    DD_SERVICEHow you want to tag your service for Unified Service Tagging.
    DD_VERSIONHow you want to tag your version for Unified Service Tagging.
    DD_TAGSYour comma-separated custom tags. For example, key1:value1,key2:value2.

What’s next?

Enable/disable trace metrics

Trace metrics are enabled by default. To configure trace metrics, use the following environment variable:

DD_TRACE_TRACER_METRICS_ENABLED
Enables (true) or disables (false) trace metrics. Defaults to true.

Values: true, false

Troubleshooting

Enable debug logs

You can collect debug logs for troubleshooting. To configure debug logs, use the following environment variables:

DD_TRACE_DEBUG
Enables (true) or disables (false) debug logging for the Datadog Tracing Library. Defaults to false.

Values: true, false

DD_LOG_LEVEL
Sets logging level for the Datadog Serverless Compatibility Layer. Defaults to info.

Values: trace, debug, info, warn, error, critical, off

Linux Consumption plans and GitHub Actions

To use a GitHub Action to deploy to a Linux Consumption function, you must configure your workflow to use an Azure Service Principal for RBAC. See Using Azure Service Principal for RBAC as Deployment Credential.

PREVIEWING: dd-dominic/update-metadata-reference