Skip to content

[SVLS-7025] improve AAS documentation #30014

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
21 changes: 12 additions & 9 deletions content/en/serverless/azure_app_services/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@ further_reading:

[Azure App Service][1] hosts web applications, REST APIs, and mobile backends.

Datadog provides the following monitoring capabilities for all Azure App Service resource types:
To get started with monitoring Azure App Service, install the Azure integration for metrics and logs, and Azure App Service instrumentation for APM and custom metrics.

- Azure Monitor [metrics][2] for web apps, using the [Azure integration][3].
- The [Azure App Service View][4] in Datadog, where you can quickly spot issues, map relationships between your Azure App Service resources, and gain insights into cost and performance.
- Submit custom metrics through the API.
- Submit [resource logs][5] through [Event Hub][6].
### Azure Integration

Datadog provides additional monitoring capabilities for the following Azure App Service workload runtimes on Basic, Standard, and Premium plans:
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.

Additionally, [set up Azure log forwarding][5] 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|
|----|---------|-----|
Expand Down Expand Up @@ -60,9 +63,9 @@ Capabilities:
[1]: https://learn.microsoft.com/en-us/azure/app-service/overview
[2]: /integrations/azure_app_services/#metrics
[3]: /integrations/azure/
[4]: https://app.datadoghq.com/functions?search=&cloud=azure&entity_view=app_service_plan
[5]: /integrations/azure/#log-collection
[6]: https://learn.microsoft.com/azure/event-hubs/
[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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,73 +11,74 @@ further_reading:
text: "Azure App Service Environment"
---

<div class="alert alert-info">To instrument your Azure App Service containers with <code>serverless-init</code>, see <a href="/serverless/guide/azure_app_service_linux_containers_serverless_init">Instrument Azure App Service - Linux Container with serverless-init</a>.</div>

### Prerequisites

This document assumes that your application is set up for sidecars according to Azure's [Configure a sidecar container for custom container in Azure App Service][1] tutorial.

If you would prefer to not use the sidecar approach (Not Recommended), you can instead follow the instructions to [Instrument Azure App Service - Linux Container with `serverless-init`][2].

## Setup

### Application

{{< tabs >}}
{{% tab "Node.js" %}}
#### Tracing
Instrument your main application with the `dd-trace-js` library. See [Tracing Node.js applications][1] for instructions.
Instrument your main application with the `dd-trace-js` library. See [Tracing Node.js applications][101] for instructions.

#### Metrics
Custom metrics are also collected through the tracer. See the [code examples][2].
Custom metrics are also collected through the tracer. See the [code examples][102].

#### Logs
The Datadog sidecar uses file tailing to collect logs. Datadog recommends writing application logs to `/home/LogFiles/` because this directory is persisted across restarts.

You can also create a subdirectory, such as `/home/LogFiles/myapp`, if you want more control over what is sent to Datadog. However, if you do not tail all log files in `/home/LogFiles`, then Azure App Service application logs related to startups and errors are not collected.

To set up logging in your application, see [Node.js Log Collection][3]. To set up trace log correlation, see [Correlating Node.js Logs and Traces][4].
To set up logging in your application, see [Node.js Log Collection][103]. To set up trace log correlation, see [Correlating Node.js Logs and Traces][104].

[1]: /tracing/trace_collection/automatic_instrumentation/dd_libraries/nodejs/#getting-started
[2]: /metrics/custom_metrics/dogstatsd_metrics_submission/?code-lang=nodejs#code-examples
[3]: /logs/log_collection/nodejs/?tab=winston30
[4]: /tracing/other_telemetry/connect_logs_and_traces/nodejs
[101]: /tracing/trace_collection/automatic_instrumentation/dd_libraries/nodejs/#getting-started
[102]: /metrics/custom_metrics/dogstatsd_metrics_submission/?code-lang=nodejs#code-examples
[103]: /logs/log_collection/nodejs/?tab=winston30
[104]: /tracing/other_telemetry/connect_logs_and_traces/nodejs
{{% /tab %}}
{{% tab "Python" %}}
#### Tracing
Instrument your main application with the `dd-trace-py` library. See [Tracing Python applications][1] for instructions.
Instrument your main application with the `dd-trace-py` library. See [Tracing Python applications][201] for instructions.

#### Metrics
Custom metrics are also collected through the tracer. See the [code examples][2].
Custom metrics are also collected through the tracer. See the [code examples][202].

#### Logs
The Datadog sidecar uses file tailing to collect logs. Datadog recommends writing application logs to `/home/LogFiles/` because this directory is persisted across restarts.

You can also create a subdirectory, such as `/home/LogFiles/myapp`, if you want more control over what is sent to Datadog. However, if you do not tail all log files in `/home/LogFiles`, then Azure App Service application logs related to startups and errors are not collected.

To set up logging in your application, see [Node.js Log Collection][3]. To set up trace log correlation, see [Correlating Node.js Logs and Traces][4].
To set up logging in your application, see [Node.js Log Collection][203]. To set up trace log correlation, see [Correlating Node.js Logs and Traces][204].

[1]: /tracing/trace_collection/automatic_instrumentation/dd_libraries/python
[2]: /metrics/custom_metrics/dogstatsd_metrics_submission/?code-lang=python#code-examples
[3]: /logs/log_collection/python/
[4]: /tracing/other_telemetry/connect_logs_and_traces/python
[201]: /tracing/trace_collection/automatic_instrumentation/dd_libraries/python
[202]: /metrics/custom_metrics/dogstatsd_metrics_submission/?code-lang=python#code-examples
[203]: /logs/log_collection/python/
[204]: /tracing/other_telemetry/connect_logs_and_traces/python
{{% /tab %}}
{{% tab "Java" %}}
#### Tracing
Instrument your main application with the `dd-trace-java` library. See [Tracing Java applications][1] for instructions.
Instrument your main application with the `dd-trace-java` library. See [Tracing Java applications][301] for instructions.

#### Metrics
Custom metrics are also collected through the tracer. See the [code examples][2].
Custom metrics are also collected through the tracer. See the [code examples][302].

#### Logs
The Datadog sidecar uses file tailing to collect logs. Datadog recommends writing application logs to `/home/LogFiles/` because this directory is persisted across restarts.

You can also create a subdirectory, such as `/home/LogFiles/myapp`, if you want more control over what is sent to Datadog. However, if you do not tail all log files in `/home/LogFiles`, then Azure App Service application logs related to startups and errors are not collected.

To set up logging in your application, see [Node.js Log Collection][3]. To set up trace log correlation, see [Correlating Node.js Logs and Traces][4].
To set up logging in your application, see [Node.js Log Collection][303]. To set up trace log correlation, see [Correlating Node.js Logs and Traces][304].

[1]: /tracing/trace_collection/automatic_instrumentation/dd_libraries/java/#getting-started
[2]: /metrics/custom_metrics/dogstatsd_metrics_submission/?code-lang=java#code-examples
[3]: /logs/log_collection/java/?tab=winston30
[4]: /tracing/other_telemetry/connect_logs_and_traces/java
[301]: /tracing/trace_collection/automatic_instrumentation/dd_libraries/java/#getting-started
[302]: /metrics/custom_metrics/dogstatsd_metrics_submission/?code-lang=java#code-examples
[303]: /logs/log_collection/java/?tab=winston30
[304]: /tracing/other_telemetry/connect_logs_and_traces/java
{{% /tab %}}
{{% tab ".NET" %}}
#### Tracing
Expand Down Expand Up @@ -129,65 +130,103 @@ RUN cd /datadog/tracer && tar -zxf datadog-dotnet-apm-2.51.0.tar.gz
ENTRYPOINT ["dotnet", "<your dotnet app>.dll"]
{{< /highlight >}}

For more information, see [Tracing .NET Applications][1].
For more information, see [Tracing .NET Applications][401].

#### Metrics
Custom metrics are also collected through the tracer. See the [code examples][2].
Custom metrics are also collected through the tracer. See the [code examples][402].

#### Logs
The Datadog sidecar uses file tailing to collect logs. Datadog recommends writing application logs to `/home/LogFiles/` because this directory is persisted across restarts.

You can also create a subdirectory, such as `/home/LogFiles/myapp`, if you want more control over what is sent to Datadog. However, if you do not tail all log files in `/home/LogFiles`, then Azure App Service application logs related to startups and errors are not collected.

To set up logging in your application, see [C# Log Collection][3]. To set up trace log correlation, see [Correlating .NET Logs and Traces][4].
To set up logging in your application, see [C# Log Collection][403]. To set up trace log correlation, see [Correlating .NET Logs and Traces][404].

[1]: /tracing/trace_collection/automatic_instrumentation/dd_libraries/dotnet-core
[2]: /metrics/custom_metrics/dogstatsd_metrics_submission/?code-lang=dotnet#code-examples
[3]: /logs/log_collection/csharp
[4]: /tracing/other_telemetry/connect_logs_and_traces/dotnet
[401]: /tracing/trace_collection/automatic_instrumentation/dd_libraries/dotnet-core
[402]: /metrics/custom_metrics/dogstatsd_metrics_submission/?code-lang=dotnet#code-examples
[403]: /logs/log_collection/csharp
[404]: /tracing/other_telemetry/connect_logs_and_traces/dotnet

{{% /tab %}}
{{% tab "Go" %}}
#### Tracing
Instrument your main application with the `dd-trace-go` library. See [Tracing Go applications][1] for instructions.
Instrument your main application with the `dd-trace-go` library. See [Tracing Go applications][501] for instructions.

#### Metrics
Custom metrics are also collected through the tracer. See the [code examples][2].
Custom metrics are also collected through the tracer. See the [code examples][502].

#### Logs
The Datadog sidecar uses file tailing to collect logs. Datadog recommends writing application logs to `/home/LogFiles/` because this directory is persisted across restarts.

You can also create a subdirectory, such as `/home/LogFiles/myapp`, if you want more control over what is sent to Datadog. However, if you do not tail all log files in `/home/LogFiles`, then Azure App Service application logs related to startups and errors are not collected.

To set up logging in your application, see [Node.js Log Collection][3]. To set up trace log correlation, see [Correlating Node.js Logs and Traces][4].
To set up logging in your application, see [Node.js Log Collection][503]. To set up trace log correlation, see [Correlating Node.js Logs and Traces][504].

[1]: /tracing/trace_collection/automatic_instrumentation/dd_libraries/go
[2]: /metrics/custom_metrics/dogstatsd_metrics_submission/?code-lang=go#code-examples
[3]: /logs/log_collection/go/
[4]: /tracing/other_telemetry/connect_logs_and_traces/go
[501]: /tracing/trace_collection/automatic_instrumentation/dd_libraries/go
[502]: /metrics/custom_metrics/dogstatsd_metrics_submission/?code-lang=go#code-examples
[503]: /logs/log_collection/go/
[504]: /tracing/other_telemetry/connect_logs_and_traces/go
{{% /tab %}}
{{% tab "PHP" %}}
#### Tracing
Instrument your main application with the `dd-trace-php` library. See [Tracing PHP applications][1] for instructions.
Instrument your main application with the `dd-trace-php` library. See [Tracing PHP applications][601] for instructions.

#### Metrics
Custom metrics are also collected through the tracer. See the [code examples][2].
Custom metrics are also collected through the tracer. See the [code examples][602].

#### Logs
The Datadog sidecar uses file tailing to collect logs. Datadog recommends writing application logs to `/home/LogFiles/` because this directory is persisted across restarts.

You can also create a subdirectory, such as `/home/LogFiles/myapp`, if you want more control over what is sent to Datadog. However, if you do not tail all log files in `/home/LogFiles`, then Azure App Service application logs related to startups and errors are not collected.

To set up logging in your application, see [Node.js Log Collection][3]. To set up trace log correlation, see [Correlating Node.js Logs and Traces][4].
To set up logging in your application, see [Node.js Log Collection][603]. To set up trace log correlation, see [Correlating Node.js Logs and Traces][604].

[1]: /tracing/trace_collection/automatic_instrumentation/dd_libraries/php/#getting-started
[2]: /metrics/custom_metrics/dogstatsd_metrics_submission/?code-lang=php#code-examples
[3]: /logs/log_collection/php/
[4]: /tracing/other_telemetry/connect_logs_and_traces/php
[601]: /tracing/trace_collection/automatic_instrumentation/dd_libraries/php/#getting-started
[602]: /metrics/custom_metrics/dogstatsd_metrics_submission/?code-lang=php#code-examples
[603]: /logs/log_collection/php/
[604]: /tracing/other_telemetry/connect_logs_and_traces/php
{{% /tab %}}
{{< /tabs >}}

### Sidecar container
### Instrumentation

Instrumentation is done through a sidecar container that runs alongside your main application container. This sidecar container collects traces, metrics, and logs from your main application container and sends them to Datadog.

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

#### Using the Datadog CLI

First, install the [Datadog CLI][601] and [Azure CLI][602].

Login to your Azure account using the Azure CLI:

{{< code-block lang="shell" >}}
az login
{{< /code-block >}}

Then, run the following command to set up the sidecar container:

{{< code-block lang="shell" >}}
export DD_API_KEY=<DATADOG_API_KEY>
export DD_SITE=<DATADOG_SITE>
datadog-ci aas instrument -s <subscription-id> -r <resource-group-name> -n <app-service-name>
{{< /code-block >}}

Set your Datadog site to {{< region-param key="dd_site" code="true" >}}. Defaults to `datadoghq.com`.

**Note:** For .NET applications, add the `--dotnet` flag to include the additional environment variables required by the .NET tracer.

Additional flags, like `--service` and `--env`, can be used to set the service and environment tags. For a full list of options, run `datadog-ci aas instrument --help`.


[601]: https://github.com/DataDog/datadog-ci#how-to-install-the-cli
[602]: https://learn.microsoft.com/en-us/cli/azure/install-azure-cli
{{% /tab %}}

{{% tab "Manual" %}}

#### Sidecar container

1. In the Azure Portal, go to **Deployment Center** and select **Add**.
2. In the **Edit container** form, provide the following:
Expand All @@ -198,13 +237,13 @@ To set up logging in your application, see [Node.js Log Collection][3]. To set u
- **Port**: 8126
3. Select **Apply**.

### Application settings
#### Application settings

In your **App settings** in Azure, set the following environment variables on both your main container and the sidecar container. Alternatively, set these variables on your main container and enable the **Allow access to all app settings** option.

{{< img src="serverless/azure_app_service/app_settings.png" alt="In Azure, an Environment Variables section. An 'Allow access to all app settings' option is enabled with a checkbox." >}}

- `DD_API_KEY`: Your [Datadog API key][3]
- `DD_API_KEY`: Your [Datadog API key][701]
- `DD_SERVICE`: How you want to tag your service. For example, `sidecar-azure`
- `DD_ENV`: How you want to tag your env. For example, `prod`
- `DD_SERVERLESS_LOG_PATH`: Where you write your logs. For example, `/home/LogFiles/*.log` or `/home/LogFiles/myapp/*.log`
Expand All @@ -222,12 +261,16 @@ If you are setting up monitoring for a .NET application, configure the following
| Variable name | Value |
| ------------- | ----- |
| `DD_DOTNET_TRACER_HOME` | `/datadog/tracer` |
| `DD_TRACE_LOG_DIRECTORY` | `/home/Logfiles/dotnet` |
| `DD_TRACE_LOG_DIRECTORY` | `/home/LogFiles/dotnet` |
| `CORECLR_ENABLE_PROFILING` | `1` |
| `CORECLR_PROFILER` | `{846F5F1C-F9AE-4B07-969E-05C26BC060D8}` |
| `CORECLR_PROFILER_PATH` | `/datadog/tracer/Datadog.Trace.ClrProfiler.Native.so` |
</details>

[701]: https://app.datadoghq.com/organization-settings/api-keys
{{% /tab %}}
{{< /tabs >}}

## Example application
The following example contains a single app with tracing, metrics, and logs set up.

Expand Down Expand Up @@ -458,5 +501,4 @@ $statsd->increment('page.views', 1, array('environment'=>'dev'));
{{< /tabs >}}

[1]: https://learn.microsoft.com/en-us/azure/app-service/tutorial-custom-container-sidecar
[2]: https://docs.datadoghq.com/metrics/custom_metrics/dogstatsd_metrics_submission/#code-examples
[3]: https://app.datadoghq.com/organization-settings/api-keys
[2]: /serverless/guide/azure_app_service_linux_containers_serverless_init
Loading
Loading