Monitoring Azure App Services

After you install the Instana host agent, the Azure App Services sensor is automatically installed and enabled. You can view metrics that are related to Azure App Services in the Instana UI.

For more information about other supported Azure services, see Azure.

Configuration

The Azure App Service sensor is enabled by default. You can disable the Azure App Service sensor and filter the Azure App Service sensor by using tags and resource groups. To configure the Azure App Service sensor, edit the agent configuration file, <agentinstall_dir>/etc/instana/configuration.yaml as follows:

com.instana.plugin.azure.appservice:
  # Valid values: true, false
  enabled: false # enabled (true) by default
  # Comma separated list of tags in key:value format
  include_tags:
  # Comma separated list of tags in key:value format
  exclude_tags:
  # Comma separated list of resource groups
  include_resource_groups:
  # Comma separated list of resource groups
  exclude_resource_groups:

You can disable the Azure App Service sensor. To disable monitoring of the Azure App Services, use the following configuration:

com.instana.plugin.azure.appservice:
  enabled: false

You can define multiple tags and resource groups and separate them by a comma. Tags must be provided as a key-value pair, which is separated by :. You can also define which tags and resource groups you want to include or exclude from discovery. If you define tags or resource groups in both lists (that is, the include and exclude lists), the exclude list has higher priority. If you don't need to use service filtering, do not define values to enable filtering.

To include services by tags into discovery, use the following configuration:

com.instana.plugin.azure.appservice:
  include_tags: # Comma separated list of tags in key:value format (e.g. env:prod,env:staging)

To exclude services by tags from discovery, use the following configuration:

com.instana.plugin.azure.appservice:
  exclude_tags: # Comma separated list of tags in key:value format (e.g. env:dev,env:test)

To include services by resource groups into discovery, use the following configuration:

com.instana.plugin.azure.appservice:
  include_resource_groups: # Comma separated list of resource groups (e.g. rg_prod,rg_staging)

To exclude services by resource groups from discovery, use the following configuration:

com.instana.plugin.azure.appservice:
  exclude_resource_groups: # Comma separated list of resource groups (e.g. rg_dev,rg_test)

You can enable the discovery filter on a global level for all Azure services. You can also define filters for a specific Azure service, which override global filters for that specific Azure service. For more information about global filters, see Azure configuration.

Viewing metrics

To view the metrics, complete the following steps:

  1. In the sidebar of the Instana UI, select Infrastructure.
  2. Click a specific monitored host.

You can see a host dashboard with all the collected metrics and monitored processes.

Metrics for App Services are pulled every minute, which is the resolution that Azure provides for the monitoring of these services.

Configuration data

App Service details Description
Name The name of the App Service.
Resource Group The resource group the App Service belongs to
Location The region where the App Service is located
Subscription ID The subscription ID of the App Service
State The current state of the App Service

Performance metrics

App Service Metric Description
Response times and requests
Response Time The response time for requests to your App Service
Total Requests Total number of requests within a minute
Queued Requests Number of requests that have been queued in a minute
HTTP status codes
Http 2xx Responses Number of HTTP responses with an HTTP status between 200 and 299
Http 4xx Responses Number of HTTP responses with an HTTP status between 400 and 499
Http 5xx Responses Number of HTTP responses with an HTTP status between 500 and 599
Network traffic metrics
Bytes sent Number of bytes sent
Bytes received Number of bytes received by the App Service
Garbage collection metrics
Generation 0 Number of garbage collection runs on Generation 0 within a minute
Generation 1 Number of garbage collection runs on Generation 1 within a minute
Generation 2 Number of garbage collection runs on Generation 2 within a minute

Instrumentation

Node.js Tracing

For more information about how to monitor a Node.js application that runs as an Azure App Service, see Azure App Service Tracing for Node.js.

.NET Tracing

Setting up Windows workloads for .NET Framework, .NET Core, and .NET

To enable instrumentation for .Net Framework, .Net Core, and .Net on Windows variants of App Services, an Instana agent must be running in the environment where you intend to monitor the App Services.

For more information about how to configure the Instana agent for Azure monitoring, see Monitoring and Instrumenting Microsoft Azure.

To set up Windows workloads, complete the following steps:

  1. Go to the Azure Portal, and locate the App Service that you want to instrument. After you open the App Service in the Azure Portal, click the Extensions link from the navigation menu.

    Extensions menu

  2. On the Extensions page, you can add a new extension, check the extensions that are installed, and update or remove an extension. You can also add the Instana Tracing App Service extension.

  3. After the Instana Tracing App Service extension is installed, you must configure it before you use it.

    1. To configure the extension, go to the Extensions page.

    2. Click the URL icon for the Instana Tracing App Service extension in the table of installed extensions. A new window is displayed where you can configure the Instana extension.

      Instrumentation configuration

  4. Complete the following configurations:

    1. Select whether you want to enable the Instana Tracing feature by using the Enable Tracing toggle.

    2. Select whether your App Services application is 32 bit or 64 bit by using the Enable 64 bit toggle. For more information, see Bitness of the application.

    3. In the Agent Key field, enter the license key of your Instana host agent.

    4. In the Endpoint URL field, enter the endpoint URL for serverless monitoring.

    5. In the Log-Level field, enter the log level that you want to use. The values that you can enter are NONE, DEBUG, INFO, WARN, and ERROR.

      Tip: The log information is generated in the root folder of the App Service application.

    6. After you enter all the information, click Update Config. The information is saved within the context of the App Service.

    7. Restart the App Service. You can restart the App Service from the Dashboard of the App Service. When you run your application, an Instana rewriter is attached to the application, and you must collect traces.

    8. To see the traces, return to the Instana UI. Open the dashboard of your App Service entity, and click Upstream / Downstream. Traces that are collected for this entity are displayed.

      Traces

Setting up Linux workloads for .NET Core and .NET

To enable instrumentation for .Net Core and .Net applications that run on Linux-based App Services, make sure that an Instana agent is active in the environment where you want to monitor App Services. For more information about how to configure the Instana agent to monitor Azure, see Monitoring and Instrumenting Microsoft Azure.

Automatic instrumentation is not available on Linux.

To capture traces, complete the following steps:

  1. Add the tracing NuGet package into your project: Instana.Tracing.Core.Rewriter.Linux

  2. After you add the tracing NuGet package, redeploy your application to the Azure App Service.

  3. After the application is redeployed, Instana tracing becomes a part of your application. To activate tracing, configure the CLR engine as follows:

    1. Go to the Configuration section on your Azure App Service dashboard.

    2. Add the following environment variables:

      CORECLR_ENABLE_PROFILING = 1
      CORECLR_PROFILER = {cf0d821e-299b-5307-a3d8-b283c03916dd}
      CORECLR_PROFILER_PATH = /home/site/wwwroot/instana_tracing/CoreProfiler.so
      DOTNET_STARTUP_HOOKS = /home/site/wwwroot/Instana.Tracing.Core.dll
      INSTANA_AGENT_KEY = the license key of your Instana host agent
      INSTANA_ENDPOINT_URL = one of the following [endpoint URL for serverless monitoring](../../setup_and_manage/endpoints_and_keys.html#endpoints-for-serverless-monitoring)
      
  4. Restart your application. To make sure that your changes are active, follow these steps:

    1. Stop the application.
    2. Wait for 1-2 minutes to clear any cached states.
    3. Start the application again.

You can now view traces in the Instana UI.

Troubleshooting

Bitness of the application

When you configure the Instana instrumentation by using the installed extension in Azure, you can see an Enable 64 bit checkbox. Depending on the bit version of your application, you must attach the appropriate rewriter.

By default, when you deploy the application through Visual Studio to Azure App Service, the application is installed in 32-bit mode. The bit version settings can be changed in the configuration of the App Service by going to Configuration > General Settings:

App Service Platform configuration

If you are using a 64-bit mode, select 64 Bit in the Instana Tracing App Service Extension configuration. Otherwise, you cannot attach and collect traces.

Tracing does not work

If tracing does not work, complete the following steps:

  1. Check that the bit version is correctly configured both in the App Service configuration and in the Instana Tracing App Service extension configuration.

  2. Make sure that the agent Key and endpoint URL are set correctly in the Instana Tracing for App Services page. For more information, see Endpoint URL for serverless monitoring.

  3. Check for errors in the Event logs by clicking Diagnose and solve problems > Application Event Logs.

    Event logs

  4. Open the Kudu Process Explorer by clicking Advanced Tools from the navigation menu. Check whether the w3wp process is attached with the Instana.Profiler_x64.dll module.

    Open Kudu

    Process Explorer

  5. Get the Instana debugging logs from the Kudu tool. In the Kudu Tool, go to Debug Console, and then go to the C:\home\site\wwwroot> folder. You can find two types of log files in the folder:

  • CLR debug logs: 1.log_YYYY-MM-DD-HH_MM_SS
  • Instrumentation logs: YYYY-MM-DD_HH_MM_SSPID