Requirements
If you haven’t already, set up the Microsoft Azure integration first.
The extension supports the following resource types:
- Azure App Service Web Apps
- Function Apps hosted on Basic, Standard, and Premium plans.
Function Apps on consumption plans are not supported. Interested in support for other App Service resource types or runtimes?
Sign up to be notified when a Preview becomes available.
The Datadog .NET APM extension supports the following .NET runtimes in both x64 and x86 architectures when running on Windows OS (AAS does not yet support extensions on Linux). For more details about automatically instrumented libraries, see the Tracer documentation.
- .NET Framework 4.6.1 and later
- .NET Core 2.1
- .NET Core 2.2 (Microsoft support ended 2019-12-23)
- .NET Core 3.0 (Microsoft support ended 2020-03-03)
- .NET Core 3.1
- .NET 5
- .NET 6
- .NET 7
- .NET 8
- .NET 9
Datadog recommends doing regular updates to the latest version of the extension to ensure optimal performance, stability, and availability of features. Note that both the initial install and subsequent updates require your web app to be fully stopped in order to install/update successfully.
Note: Datadog’s automatic instrumentation relies on the .NET CLR Profiling API. This API allows only one subscriber (for example, Datadog’s .NET Tracer with Profiler enabled). To ensure maximum visibility, run only one APM solution within your application environment.
Starting with v2.3.0, the .NET extension no longer relies on semantic versioning. The extension uses the following scheme: x.y.zAA
where x.y.z
is the .Net Tracer version and AA
is dedicated only to the extension. Any leading zeroes in zAA
is trimmed by NuGet packaging so the version becomes x.y.A
.
For example:
- Extension
2.3.0
uses the Tracer v2.3.0
- Extension
2.3.1
uses the Tracer v2.3.0
- Extension
2.3.2
uses the Tracer v2.3.0
- Extension
2.3.100
uses the Tracer v2.3.1
- Extension
2.3.101
uses the Tracer v2.3.1
- Extension
2.3.200
uses the Tracer v2.3.2
Installation
Configure the Azure integration to monitor your web app or function. Verify it is configured correctly by ensuring that you see the corresponding azure.app_services.count
or azure.functions.count
metric in Datadog. Note: This step is critical for metric/trace correlation, functional trace panel views, and improves the overall experience of using Datadog with Azure App Services.
Open the Azure Portal and navigate to the dashboard for the Azure app you wish to instrument with Datadog.
Note: Customers using the Azure Native integration can use the Datadog resource in Azure to add the extension to their .NET apps. For instructions, see the App Service extension section of Datadog’s Azure Portal guide.
Go to the Application settings tab of the Configuration page.
Add your Datadog API key as an application setting called DD_API_KEY
and a value of your Datadog API Key.
Configure optional application settings:
- Set the
DD_SITE
to
(defaults to datadoghq.com
). - Set
DD_ENV
to group your traces and custom statistics. - Set
DD_SERVICE
to specify a service name (defaults to your app name). - Set
DD_LOGS_INJECTION:true
for correlation with application logs from your app. - Set
DD_PROFILING_ENABLED:true
to enable .NET Continuous Profiler. - Set
DD_APPSEC_ENABLED:true
to enable Application Security. - See a full list of optional configuration variables.
Click Save (this restarts your application).
[REQUIRED] Stop your application by clicking Stop.
Go to the Azure extensions page and select the Datadog APM extension.
Accept the legal terms, click OK, and wait for the installation to complete. Note: the app must be in a stopped state for this step to complete successfully.
Start the main application, click Start:
Application logging
You can send logs from your application in Azure App Service to Datadog in one of the following ways:
- Agentless logging with automatic instrumentation
- Agentless logging with the Serilog sink
Both methods allow trace ID injection, making it possible to connect logs and traces in Datadog. To enable trace ID injection with the extension, add the application setting DD_LOGS_INJECTION:true
.
Note: Since this occurs inside your application, any Azure Platform logs you submit with diagnostic settings do not include the trace ID.
Custom metrics with DogStatsD
The Azure App Service extension includes an instance of DogStatsD (Datadog’s metrics aggregation service). This enables you to submit custom metrics, service checks, and events directly to Datadog from Azure Web Apps and Functions with the extension.
Writing custom metrics and checks in Azure App Service is similar to the process for doing so with an application on a host running the Datadog Agent. To submit custom metrics to Datadog from Azure App Service using the extension:
- Add the DogStatsD NuGet package to your Visual Studio project.
- Initialize DogStatsD and write custom metrics in your application.
- Deploy your code to Azure App Service.
- If you have not already, install the Datadog App Service extension.
Note: Unlike the standard DogStatsD config process, there is no need to set ports or a server name when initializing the DogStatsD configuration. There are ambient environment variables in Azure App Service that determine how the metrics are sent (requires v6.0.0+ of the DogStatsD client).
To send metrics use this code:
// Configure your DogStatsd client and configure any tags
if (!DogStatsd.Configure(new StatsdConfig() { ConstantTags = new[] { "app:sample.mvc.aspnetcore" } }))
{
// `Configure` returns false if the necessary environment variables are not present.
// These environment variables are present in Azure App Service, but
// need to be set in order to test your custom metrics: DD_API_KEY:{api_key}, DD_AGENT_HOST:localhost
// Ignore or log the error as it suits you
Console.WriteLine("Cannot initialize DogstatsD.");
}
// Send a metric
DogStatsd.Increment("sample.startup");
Note: To send only custom metrics (while disabling tracing) set the following variables in your application’s config:
- Set
DD_TRACE_ENABLED
to false
. - Set
DD_AAS_ENABLE_CUSTOM_METRICS
to true
.
Learn more about custom metrics.
Requirements
If you haven’t already, set up the Microsoft Azure integration first.
The extension supports Azure App Service Web Apps. Function Apps are not supported.
Support for Java Web Apps is in Preview for extension v2.4+. There are no billing implications for tracing Java Web Apps during this period.
Interested in support for other App Service resource types or runtimes?
Sign up to be notified when a Preview becomes available.
The Datadog Java APM extension supports all Java runtimes on Windows OS. Azure App Service does not support extensions on Linux. For more details about automatically instrumented libraries, see the Tracer documentation.
Datadog recommends doing regular updates to the latest version of the extension to ensure optimal performance, stability, and availability of features. Note that both the initial install and subsequent updates require your web app to be fully stopped in order to install/update successfully.
Installation
Configure the Azure integration to monitor your web app or function. Verify it is configured correctly by ensuring that you see the corresponding azure.app_service.count
or azure.functions.count
metric in Datadog. Note: This step is critical for metric/trace correlation, functional trace panel views, and avoiding various broken user experiences on the Datadog site.
Open the Azure Portal and navigate to the dashboard for the Azure Web App you wish to instrument with Datadog.
Go to the Application settings tab of the Configuration page.
Add your Datadog API key as an application setting called DD_API_KEY
and a value of your Datadog API Key.
Configure optional application settings:
- Set the
DD_SITE
to
(defaults to datadoghq.com
). - Set
DD_ENV
to group your traces and custom statistics. - Set
DD_SERVICE
to specify a service name (defaults to your web app name). - See a full list of optional configuration variables.
Click Save (this restarts your application).
[REQUIRED] Stop your application by clicking Stop.
Go to the Azure extensions page and select the Datadog APM extension.
Accept the legal terms, click OK, and wait for the installation to complete. Note: the web app must be in a stopped state for this step to complete successfully.
Start the main application, click Start:
Application logging from Azure Web Apps
Sending logs from your application in Azure App Service to Datadog requires streaming logs to Datadog directly from your app. Submitting logs with this method allows for trace ID injection, which makes it possible to connect logs and traces in Datadog.
Note: Trace ID injection occurs inside your application. Azure Resource logs are generated by Azure in the management plane, and therefore do not include the trace ID.
See instructions for Agentless logging with Java to configure application logging for Java in Azure App Service.
Custom metrics with DogStatsD
The Azure App Service extension includes an instance of DogStatsD (Datadog’s metrics aggregation service). This enables you to submit custom metrics, service checks, and events directly to Datadog from Azure Web Apps with the extension.
Writing custom metrics and checks in this environment is similar to the process for doing so with an application on a standard host running the Datadog Agent. To submit custom metrics to Datadog from Azure App Service using the extension:
- Add the DogStatsD client to your project.
- Initialize DogStatsD and write custom metrics in your application.
- Deploy your code to a supported Azure web app.
- If you have not already, install the Datadog App Service extension.
Note: Unlike the standard DogStatsD config process, there is no need to set ports or a server name when initializing the DogStatsD configuration. There are ambient environment variables in Azure App Service that determine how the metrics are sent (requires v6.0.0+ of the DogStatsD client).
To send metrics use this code:
// Configure your DogStatsd client and configure any tags
StatsDClient client = new NonBlockingStatsDClientBuilder()
.constantTags("app:sample.service")
.build();
// Send a metric
client.Increment("sample.startup");
Learn more about custom metrics.
Requirements
If you haven’t already, set up the Datadog-Azure integration first.
Datadog’s Azure App Service Node.js extension supports Azure App Service Web Apps. Function Apps are not supported.
Installation
Configure the Datadog-Azure integration to monitor your Azure Web App. To verify, check that your Web App is counted in the azure.app_service.count
metric in Datadog.
Open the Azure Portal and navigate to the dashboard for the Azure Web App you wish to instrument with Datadog.
On the Configuration page, go to the Application settings tab. Select + New application setting.
Add your Datadog API key as the value of an application setting with the name DD_API_KEY
.
Optionally, you can set further environment variables as application settings. These variables include:
DD_SITE
:
(defaults to datadoghq.com
)DD_ENV
: Your environment nameDD_SERVICE
: Your service name (defaults to your Web App name)DD_RUNTIME_METRICS_ENABLED
: true
to enable runtime metricsDD_APPSEC_ENABLED
: true
to enable Application Security Management
See the full list of optional configuration settings.
Select Save. This restarts your application.
Stop your application.
On the Extensions page, select the Node Datadog APM extension.
Accept the legal terms, select OK, and wait for the installation to complete.
Start your application.
Application logging from Azure Web Apps
Sending logs from your application in Azure App Service to Datadog requires streaming logs to Datadog directly from your app. Submitting logs with this method allows for trace ID injection, which makes it possible to connect logs and traces in Datadog.
To configure application logging for Node.js in Azure App Service, see Agentless logging with Node.js.
Azure resource logs do not include trace ID.
Trace ID injection occurs inside your application. Azure resource logs are generated by Azure in the management plane, and therefore do not include the trace ID.
Custom metrics with DogStatsD
Datadog’s Azure App Service Node.js extension includes an instance of DogStatsD, Datadog’s metrics aggregation service. This enables you to submit custom metrics, service checks, and events directly to Datadog from Azure Web Apps.
Writing custom metrics and checks in this environment is similar to the process for doing so with an application on a standard host running the Datadog Agent. To submit custom metrics to Datadog from Azure App Service using the extension:
- Initialize DogStatsD and write custom metrics in your application.
- Deploy your code to a supported Azure Web App.
- If you have not already, install Datadog’s Azure App Service Node.js extension.
You do not need to install a Node.js DogStatsD client, as it is included in the Node.js tracer (dd-trace
) packaged in the Azure App Service extension.
To send metrics, use this code:
const tracer = require('dd-trace');
tracer.init();
tracer.dogstatsd.increment('example_metric.increment', 1, { environment: 'dev' });
tracer.dogstatsd.decrement('example_metric.decrement', 1, { environment: 'dev' });
Datadog's Node.js tracer,
dd-trace
, is packaged in the Azure App Services extension. It is automatically appended to the
NODE_PATH
.
You do not need to add dd-trace
as a dependency in package.json
. Explicitly adding
dd-trace
as a dependency may override the version provided by the extension. For local testing, reference the
release notes to find the appropriate version of the Node.js tracer for your version of the Azure App Service extension.
Learn more about custom metrics.