Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 26 additions & 20 deletions content/en/serverless/azure_app_service/windows_code.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

## Overview

The Datadog extension for Azure App Service provides monitoring capabilities in addition to the [Datadog-Azure integration][7], which provides metrics and logs.
The Datadog extension for Azure App Service provides monitoring capabilities in addition to the [Datadog-Azure integration][5], which provides metrics and logs.

- Full distributed APM tracing using automatic instrumentation.
- Customized APM service and trace views showing relevant Azure App Service metrics and metadata.
Expand All @@ -48,24 +48,28 @@

{{< tabs >}}
{{% tab ".NET" %}}

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.

Additionally, if you are using the Azure Native integration, you can use the Datadog resource in Azure to add the extension to your .NET apps. For instructions, see the [App Service extension section][1] of Datadog's [Azure Native integration guide][2].

[1]: /integrations/guide/azure-native-integration/#app-service-extension
[2]: /integrations/guide/azure-native-integration/

{{% /tab %}}
{{% tab "Java" %}}
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.

{{% /tab %}}
{{< /tabs >}}

## Installation

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.

If you haven't already, set up the [Datadog-Azure integration][5]. You can verify that your Azure integration is configured correctly by ensuring that you see the `azure.app_services.count` or `azure.functions.count` metrics in Datadog.
If you haven't already, set up the [Datadog-Azure integration][3]. You can verify that your Azure integration is configured correctly by ensuring that you see the `azure.app_services.count` or `azure.functions.count` metrics in Datadog.

<div class="alert alert-info">This step is critical for metric/trace correlation and functional trace panel views and improves the overall experience of using Datadog with Azure App Services.
</div>
Expand Down Expand Up @@ -182,7 +186,7 @@

{{< img src="infrastructure/serverless/azure_app_services/choose_extension.png" alt="Example of Extensions page in Azure portal, showing .NET Datadog APM extension." style="width:100%;" >}}

6. Accept the legal terms, click **OK**, and wait for the installation to complete.
6. Accept the legal terms, click **OK**, and wait for the installation to complete.
<div class="alert alert-danger">This step requires that your application be in a stopped state.</div>

7. Start the main application, click **Start**:
Expand All @@ -201,17 +205,17 @@
{{% /tab %}}
{{< /tabs >}}


## Custom metrics

The Azure App Service extension includes an instance of [DogStatsD][3], 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.
The Azure App Service extension includes an instance of [DogStatsD][1], 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. **Unlike** the [standard DogStatsD config process][3], 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).
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. **Unlike** the [standard DogStatsD config process][1], 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).

Check notice on line 212 in content/en/serverless/azure_app_service/windows_code.md

View workflow job for this annotation

GitHub Actions / vale

Datadog.sentencelength

Suggestion: Try to keep your sentence length to 25 words or fewer.

To submit custom metrics to Datadog from Azure App Service using the extension:

{{< tabs >}}
{{% tab ".NET" %}}

1. Add the [DogStatsD NuGet package](https://www.nuget.org/packages/DogStatsD-CSharp-Client) to your Visual Studio project.
2. Initialize DogStatsD and write custom metrics in your application.
3. Deploy your code to Azure App Service.
Expand Down Expand Up @@ -255,9 +259,10 @@

{{% /tab %}}
{{% tab "Node.js" %}}

1. [Initialize DogStatsD and write custom metrics][1] in your application.
1. Deploy your code to a supported Azure Web App.
1. If you have not already, install Datadog's Azure App Service Node.js extension.
2. Deploy your code to a supported Azure Web App.
3. If you have not already, install Datadog's Azure App Service Node.js extension.

<div class="alert alert-info">You do not need to install a Node.js DogStatsD client, as it is included in the Node.js tracer (<code>dd-trace</code>) packaged in the Azure App Service extension.</div>

Expand All @@ -282,11 +287,12 @@
- Set `DD_TRACE_ENABLED` to `false`.
- Set `DD_AAS_ENABLE_CUSTOM_METRICS` to `true`.

Learn more about [custom metrics][4].
Learn more about [custom metrics][2].

## Logging

### Application logging

{{< tabs >}}
{{% tab ".NET" %}}

Expand All @@ -299,6 +305,7 @@

[1]: /logs/log_collection/csharp/#agentless-logging-with-apm
[2]: /logs/log_collection/csharp/#agentless-logging-with-serilog-sink

{{% /tab %}}
{{% tab "Java" %}}

Expand Down Expand Up @@ -334,6 +341,7 @@

{{< tabs >}}
{{% tab ".NET" %}}

**Code Example: Microsoft Native Logging**

An example of how to set up logging in a .NET application using Microsoft.Extensions.Logging:
Expand All @@ -354,12 +362,12 @@
public IActionResult Get()
{
_logger.LogInformation("Processing weather forecast request");

// Your business logic here
var forecast = GetWeatherForecast();

_logger.LogInformation("Weather forecast retrieved for user: {UserId}", userId);

return Ok(forecast);
}
}
Expand Down Expand Up @@ -537,7 +545,7 @@

1. Go to the Azure integration tile.

2. Ensure you have installed the [Azure integration][5] for the Azure subscription where your application is running.
2. Ensure you have installed the [Azure integration][3] for the Azure subscription where your application is running.

3. Ensure that any App Service plan filtering rules you have applied include the App Service plan where the app is running. If an App Service plan is not included, all apps and functions hosted on it are also not included. Tags on the app itself are not used for filtering by Datadog.

Expand All @@ -551,16 +559,14 @@

**Note**: To expedite the process of investigating application errors with the support team, set `DD_TRACE_DEBUG:true` and add the content of the Datadog logs directory (`%AzureAppServiceHomeDirectory%\LogFiles\datadog`) to your email.

Still need help? Contact [Datadog support][6].
Still need help? Contact [Datadog support][4].

### Further Reading

{{< partial name="whats-next/whats-next.html" >}}

[1]: /developers/dogstatsd
[2]: /tracing/setup/dotnet/
[3]: /developers/dogstatsd
Comment on lines -561 to -562
Copy link
Member Author

@lucaspimentel lucaspimentel Oct 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are the main changes in this PR:

  • [2] was removed - not used.
  • [1] and [3] were merged - duplicates.
  • everything moved up 2 places
  • /metrics/ became /metrics/custom_metrics/

[4]: /metrics/
[5]: /integrations/azure/
[6]: /help
[7]: https://app.datadoghq.com/integrations/azure
[2]: /metrics/custom_metrics/
[3]: /integrations/azure/
[4]: /help
[5]: https://app.datadoghq.com/integrations/azure
Loading