Skip to content

Serverless > Azure App Services Linux > Update .NET instructions #30470

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
9b046a6
Update azure_app_services_linux.md
lucaspimentel Jul 14, 2025
fea6d57
Node => Node.js
lucaspimentel Jul 14, 2025
6b99a04
fix URLs
lucaspimentel Jul 14, 2025
a757625
add missing <os-arch> to path
lucaspimentel Jul 14, 2025
b5c26ac
Node => Node.js
lucaspimentel Jul 14, 2025
4ad2b41
Update URLs
lucaspimentel Jul 14, 2025
0a92db7
clean up env var descriptions
lucaspimentel Jul 14, 2025
f7703e4
add link to nuget.org and code snippet
lucaspimentel Jul 14, 2025
4eb6c27
update url
lucaspimentel Jul 15, 2025
966bf46
Link to nuget readme. Suggestion from @andrewlock.
lucaspimentel Jul 15, 2025
efc6f7a
redo all URLs
lucaspimentel Jul 15, 2025
8067f3a
reformat table into a list
lucaspimentel Jul 15, 2025
240ab0d
reformat table
lucaspimentel Jul 15, 2025
1355d8e
formatting and links
lucaspimentel Jul 15, 2025
6189d72
add section about enabling the Continous Profiler
lucaspimentel Jul 15, 2025
acf6ae2
more link clean up
lucaspimentel Jul 15, 2025
4201219
try to fix nuget link again
lucaspimentel Jul 15, 2025
5deae7e
reword the nuget link
lucaspimentel Jul 15, 2025
2d45538
also convert the other table to a list
lucaspimentel Jul 16, 2025
1454e5e
restyle table second for consistency
lucaspimentel Jul 16, 2025
b1ae78e
fix musl path
lucaspimentel Jul 16, 2025
829d6dc
add links to Unified Service Tagging docs
lucaspimentel Jul 16, 2025
f39870d
more tweaks for .NET env vars
lucaspimentel Jul 16, 2025
8b68ca6
try to avoid wrapping
lucaspimentel Jul 16, 2025
4385b5a
remove "external link"
lucaspimentel Jul 16, 2025
63f14fa
oops, I thought I removed this
lucaspimentel Jul 16, 2025
84fe086
revert, that looked terrible
lucaspimentel Jul 16, 2025
c77a89b
if it's gonna wrap, at least do it at a logical place
lucaspimentel Jul 16, 2025
d6e6777
remove musl path (not used)
lucaspimentel Jul 17, 2025
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
54 changes: 29 additions & 25 deletions content/en/serverless/azure_app_services/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,48 +28,52 @@ To get started with monitoring Azure App Service, install the Azure integration

### Azure Integration

The [Azure integration][3] provides [enriched metrics][2] and resource metadata for Azure App Service, and are required for the [Azure App Service View][4] in Datadog. Follow the [Azure integration setup instructions][6] to install the Azure integration.
The [Azure integration][2] provides [enriched metrics][3] and resource metadata for Azure App Service, and are required for the [Azure App Service View][4] in Datadog. Follow the [Azure integration setup instructions][5] to install the Azure integration.

Additionally, [set up Azure log forwarding][5] to automatically collect and send Azure App Service resource and application logs to Datadog.
Additionally, [set up Azure log forwarding][6] to automatically collect and send Azure App Service resource and application logs to Datadog.

### Azure App Service Instrumentation

To monitor Azure App Service workloads with APM and custom metrics, install instrumentation on your Azure App Service workloads. This instrumentation is available for both Windows and Linux App Services, and supports the following runtimes on Basic, Standard, and Premium plans:

| OS | Runtime |Documentation|
|----|---------|-----|
|Windows|.NET|[Windows .NET setup][7]|
|Windows|Java|[Windows Java setup][8]|
|Windows|Node|[Windows Node setup][13]|
|Linux|.NET|[Linux .NET setup][9]|
|Linux|Node|[Linux Node setup][9]|
|Linux|PHP|[Linux PHP setup][9]|
|Linux|Java|[Linux Java setup][10]|
|Linux|Python|[Linux Python setup][9]|
|Linux|Container|[Linux Container setup][12]|
| OS | Runtime | Documentation |
|---------|-----------|-----------------------------|
| Windows | .NET | [Windows .NET setup][7] |
| Windows | Java | [Windows Java setup][8] |
| Windows | Node.js | [Windows Node.js setup][9] |
| Linux | .NET | [Linux .NET setup][10] |
| Linux | Java | [Linux Java setup][11] |
| Linux | Node.js | [Linux Node.js setup][12] |
| Linux | PHP | [Linux PHP setup][13] |
| Linux | Python | [Linux Python setup][14] |
| Linux | Container | [Linux Container setup][15] |


Capabilities:
- Fully distributed APM tracing using automatic instrumentation
- Customized APM service and trace views showing relevant Azure App Service metrics and metadata
- Manual APM instrumentation to customize spans
- `Trace_ID` injection into application logs
- Custom metrics with [DogStatsD][11]
- Custom metrics with [DogStatsD][16]

## Further reading

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

[1]: https://learn.microsoft.com/en-us/azure/app-service/overview
[2]: /integrations/azure_app_services/#metrics
[3]: /integrations/azure/
[2]: /integrations/azure/
[3]: /integrations/azure_app_services/#metrics
[4]: https://app.datadoghq.com/serverless/azure/app-service-plan
[5]: /logs/guide/azure-logging-guide/
[6]: /integrations/azure/#setup
[7]: /serverless/azure_app_services/azure_app_services_windows?tab=net#setup
[8]: /serverless/azure_app_services/azure_app_services_windows?tab=java#setup
[9]: /serverless/azure_app_services/azure_app_services_linux?tab=nodenetphppython
[10]: /serverless/azure_app_services/azure_app_services_linux?tab=java
[11]: /developers/dogstatsd/
[12]: /serverless/azure_app_services/azure_app_services_container
[13]: /serverless/azure_app_services/azure_app_services_windows?tab=nodejs#setup
[5]: /integrations/azure/#setup
[6]: /logs/guide/azure-logging-guide/
[7]: /serverless/azure_app_services/azure_app_services_windows?tab=net
[8]: /serverless/azure_app_services/azure_app_services_windows?tab=java
[9]: /serverless/azure_app_services/azure_app_services_windows?tab=nodejs
[10]: /serverless/azure_app_services/azure_app_services_linux?tab=net
[11]: /serverless/azure_app_services/azure_app_services_linux?tab=java
[12]: /serverless/azure_app_services/azure_app_services_linux/?tab=nodejs
[13]: /serverless/azure_app_services/azure_app_services_linux/?tab=php
[14]: /serverless/azure_app_services/azure_app_services_linux/?tab=python
[15]: /serverless/azure_app_services/azure_app_services_container
[16]: /developers/dogstatsd/

126 changes: 88 additions & 38 deletions content/en/serverless/azure_app_services/azure_app_services_linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ further_reading:

This solution uses a sidecar container and Application Settings for Linux Azure App Service to instrument the application and manage its configuration.

If you would prefer to not use the sidecar approach (Not Recommended), you can instead follow the instructions to [Instrument Azure App Service - Linux Code Deployment with the Datadog wrapper][17].
If you would prefer to not use the sidecar approach (Not Recommended), you can instead follow the instructions to [Instrument Azure App Service - Linux Code Deployment with the Datadog wrapper][1].

**Supported runtimes**: Java, Node.js, .NET, PHP, Python

Expand All @@ -21,6 +21,7 @@ Install the tracing library for your language:

{{< tabs >}}
{{% tab "Java" %}}

Java supports adding instrumentation code through the use of a command line argument, `javaagent`.

1. Download the [latest version of Datadog's Java tracing library][101].
Expand All @@ -31,8 +32,10 @@ Java supports adding instrumentation code through the use of a command line argu
Instrumentation starts when the application is launched.

[101]: https://dtdg.co/latest-java-tracer

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

1. Add the `ddtrace` package to your project using your package manager.
1. Initialize the tracer by doing one of the following:
- Set `NODE_OPTIONS` with `--require=dd-trace/init`
Expand All @@ -45,9 +48,15 @@ Instrumentation starts when the application is launched.
{{% /tab %}}
{{% tab ".NET" %}}

Add the `Datadog.Trace.Bundle` Nuget package to your project.
Add the `Datadog.Trace.Bundle` Nuget package to your project. See [the Nuget package page for more details][102].

For example:

```shell
dotnet add package Datadog.Trace.Bundle --version 3.21.0
```

**Note**: When you complete Step 2, ensure that you also set the [additional environment variables](#configure-environment-variables) required by the .NET tracer.
[102]: https://www.nuget.org/packages/Datadog.Trace.Bundle#readme-body-tab

{{% /tab %}}
{{% tab "PHP" %}}
Expand Down Expand Up @@ -123,27 +132,64 @@ Additional flags, like `--service` and `--env`, can be used to set the service a
1. **Configure environment variables**.
In Azure, add the following key-value pairs in **Settings** > **Configuration** > **Application settings**:

| Name | Value | Description |
|------|-------|-------------|
| `DD_API_KEY` | Your Datadog API key. | See [Organization Settings > API Keys][301] in Datadog. |
| `DD_SITE` | {{< region-param key="dd_site" code="true" >}} | Your [Datadog site][302]. Defaults to `datadoghq.com`. |
| `DD_SERVICE` | Your application's service name. | Defaults to the name field value in `package.json`. |
| `DD_ENV` | Your application's environment name. | There is no default value for this field. |
| `DD_SERVERLESS_LOG_PATH` | The log path the sidecar uses to collect logs. | Where you write your logs. For example, `/home/LogFiles/*.log` or `/home/LogFiles/myapp/*.log`. |
| `WEBSITES_ENABLE_APP_SERVICE_STORAGE` | `true` | Setting this environment variable to `true` allows the `/home/` mount to persist and be shared with the sidecar. |
`DD_API_KEY`
: **Value**: Your Datadog API key.<br>
See [Organization Settings > API Keys][301] in Datadog.<br>

`DD_SITE`
: **Value**: {{< region-param key="dd_site" code="true" >}}<br>
Your [Datadog site][302]. Defaults to `datadoghq.com`.<br>
Use the "Datadog Site" drop-down menu on this page's right navigation bar to select your site.<br>

`DD_SERVICE`
: **Value**: Your application's service name.<br>
Defaults to the name field value in `package.json`.<br>
See [Unified Service Tagging][303] for more information on the `service` tag.<br>

`DD_ENV`
: **Value**: Your application's environment name.<br>
There is no default value for this field.<br>
See [Unified Service Tagging][303] for more information on the `env` tag.<br>

`DD_VERSION`
: **Value**: Your application's version.<br>
There is no default value for this field.<br>
See [Unified Service Tagging][303] for more information on the `version` tag.<br>

`DD_SERVERLESS_LOG_PATH`
: **Value**: The log path the sidecar uses to collect logs.<br>
Where you write your logs. For example, `/home/LogFiles/*.log` or `/home/LogFiles/myapp/*.log`.<br>

`WEBSITES_ENABLE_APP_SERVICE_STORAGE`
: **Value**: `true`<br>
Setting this environment variable to `true` allows the `/home/` mount to persist and be shared with the sidecar.<br>

{{% collapse-content title=".NET: Additional required environment variables" level="h4" id="dotnet-additional-settings" %}}

For .NET applications, the following environment variables are **required** unless otherwise specified:
For .NET applications, the following environment variables are **required**. See the `Datadog.Tracer.Bundle` [Nuget package README file][1] for more details.

`DD_DOTNET_TRACER_HOME`
: **Value**: `/home/site/wwwroot/datadog`<br>
Path to the directory containing the .NET tracing libraries.<br>

`DD_TRACE_LOG_DIRECTORY`
: **Value**: `/home/LogFiles/dotnet`<br>
Path where the .NET tracing library will write its logs.<br>

`CORECLR_ENABLE_PROFILING`
: **Value**: `1`<br>
Enables the instrumentation APIs in the .NET runtime.<br>

| Name | Value | Description |
|------|-------|-------------|
| `DD_DOTNET_TRACER_HOME` | `/home/site/wwwroot/datadog` | Path to tracing libraries, copied within the Docker file |
| `DD_TRACE_LOG_DIRECTORY` | `/home/LogFiles/dotnet` | Where tracer logs are stored |
| `CORECLR_ENABLE_PROFILING` | 1 | Instructs the .NET CLR that profiling should be enabled. |
| `CORECLR_PROFILER` | `{846F5F1C-F9AE-4B07-969E-05C26BC060D8}` | Profiler GUID. |
| `CORECLR_PROFILER_PATH` | `/home/site/wwwroot/datadog/linux-musl-x64/Datadog.Trace.ClrProfiler.Native.so` | The profiler binary that the .NET CLR loads into memory, which contains the GUID. |
| `DD_PROFILING_ENABLED` (_optional_) | `true` | Enables Datadog's [Continuous Profiler][303]. |
`CORECLR_PROFILER`
: **Value**: `{846F5F1C-F9AE-4B07-969E-05C26BC060D8}`<br>
Identifier for Datadog's .NET the instrumentation library.<br>

`CORECLR_PROFILER_PATH`
: **Value**: `/home/site/wwwroot/datadog/`<br>
`linux-x64/Datadog.Trace.ClrProfiler.Native.so` (single line)<br>
Path to the instrumentation library loaded by the .NET runtime.<br>

[1]: https://www.nuget.org/packages/Datadog.Trace.Bundle#readme-body-tab

{{% /collapse-content %}}

Expand All @@ -165,23 +211,28 @@ For .NET applications, the following environment variables are **required** unle

[301]: https://app.datadoghq.com/organization-settings/api-keys
[302]: /getting_started/site/
[303]: /profiler
[303]: /getting_started/tagging/unified_service_tagging

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

### View traces in Datadog

After your application restarts, go to Datadog's [APM Service page][4] and search for the service name you set for your application (`DD_SERVICE`).
After your application restarts, go to Datadog's [APM Service page][1] and search for the service name you set for your application (`DD_SERVICE`).

### Custom metrics

To configure your application to submit custom metrics, follow the appropriate steps for your runtime:

- [Java][9]
- [Node][5]
- [.NET][6]
- [PHP][10]
- [Python][11]
- [Java][3]
- [Node.js][4]
- [.NET][5]
- [PHP][6]
- [Python][7]

### Continuous Profiler

To enable the Continuous Profiler, set the environment variable `DD_PROFILING_ENABLED=true`. For more information, see the [Continuous Profiler documentation][8].

## Deployment

Expand All @@ -195,19 +246,18 @@ Be sure to enable **App Service logs** to receive debugging logs.

{{< img src="serverless/azure_app_service/app-service-logs.png" alt="Azure App Service Configuration: App Service logs, under the Monitoring section of Settings in the Azure UI. The 'Application logging' option is set to 'File System'." style="width:100%;" >}}

Share the content of the **Log stream** with [Datadog Support][14].
Share the content of the **Log stream** with [Datadog Support][9].

## Further reading

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

[1]: /developers/dogstatsd
[3]: https://www.datadoghq.com/blog/azure-app-service-datadog-serverless-view/
[4]: /tracing/services/service_page/
[5]: https://github.com/brightcove/hot-shots
[6]: /developers/dogstatsd/?tab=hostagent&code-lang=dotnet#code
[9]: https://docs.datadoghq.com/developers/dogstatsd/?tab=hostagent&code-lang=java
[10]: https://docs.datadoghq.com/developers/dogstatsd/?tab=hostagent&code-lang=php
[11]: https://docs.datadoghq.com/developers/dogstatsd/?tab=hostagent&code-lang=python
[14]: /help
[17]: /serverless/guide/azure_app_service_linux_code_wrapper_script
[1]: /serverless/guide/azure_app_service_linux_code_wrapper_script
[2]: /tracing/services/service_page/
[3]: /developers/dogstatsd/?tab=java#dogstatsd-client
[4]: https://github.com/brightcove/hot-shots
[5]: /developers/dogstatsd/?tab=dotnet#dogstatsd-client
[6]: /developers/dogstatsd/?tab=php#dogstatsd-client
[7]: /developers/dogstatsd/?tab=python#dogstatsd-client
[8]: /profiler/
[9]: /help
Loading