Monitoring Azure Functions Service

To view metrics that are related to Azure Functions Service in the Instana UI, you need to install the Instana host agent and then enable the Azure sensor as described in the Configuring the sensor section. The Azure Functions sensor is automatically enabled after you install the Instana host agent.

To view Azure Functions traces in the Instana UI, you need to add an Instana Azure Functions tracer to your Azure Functions applications as described in the Installing Instana Azure Functions tracers section.

For other supported Azure services, see Azure documentation.

Configuring

Configuring the sensor

You must enable the Azure sensor in the agent configuration.yaml file <agentinstall_dir>/etc/instana/configuration.yaml`. A minimal sensor configuration looks like as follows:

com.instana.plugin.azure:
  enabled: true
  subscription: "[Your-Subscription-Id]"
  tenant: "[Your-Tenant-Id]"
  principals:
    - id: "[Your-Service-Principal-Account-Id]"
      secret: "[Your-Service-Principal-Secret]"

The Azure Functions Service sensor is enabled by default.

Optional configuration

The Azure Functions sensor can be disabled, and it can be filtered by tags and resource groups. You can configure the Azure Functions sensor by using the agent configuration in <agentinstall_dir>/etc/instana/configuration.yaml by:

com.instana.plugin.azure.functionapp:
  # 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:

To disable monitoring of the Azure Functions services, use the following configuration:

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

Multiple tags and resource groups can be defined, which are separated by a comma. Tags need to be provided as a key-value pair, which are separated by colon (:). To make the configuration easier, you can define which tags and resource groups you want to include in discovery or exclude from discovery. In case of defining tag or resource group in both lists (include and exclude), the exclude list has a higher priority. If there is no need for services filtering, don't define the configuration. It's not mandatory to define all values to enable filtering.

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

com.instana.plugin.azure.functionapp:
  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.functionapp:
  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.functionapp:
  include_resource_groups: # Comma separated list of resource groups (e.g. rg_prod,rg_staging)

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

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

Discovery filtering can be configured on the global level for all Azure services. In case of defining filters for Azure Functions service, global filters will be overridden. For more details about global Azure service discovery filtering, see Azure configuration.

Installing Instana Azure Functions tracers

You can enable instrumentation of Azure Functions deployed as AppService running on Windows or Docker containers. To enable instrumentation for .Net Framework, .Net Core, and .Net, ensure that the Instana agent is running in the environment where you intend to monitor Azure Functions. To configure the Instana agent for Azure monitoring, see Monitoring and Instrumenting Microsoft Azure.

Installing Instana Azure Functions tracers on Windows

Azure Functions is based on App Service. The installation and configuration process for Azure Functions and Azure App Services is the same.

To install the Instana Azure Functions tracers on Windows, complete the following steps:

  1. Log on to Microsoft Azure portal.

  2. Locate the Azure Function that you want to instrument.

  3. Click Extensions in the Development Tools panel. Extensions menu

  4. On the Extensions page, add the Instana Tracing AppService extension. After the Instana Tracing AppService extension is installed, configure the extension to use it.

  5. Go to the Extensions page, and click URL on the Instana Tracing AppService extension. The Instana Tracing for App Services dialog is displayed.
    Instrumentation configuration

    1. In the Instana Tracing for AppServices window, set Enable Tracing to on.

    2. Optional: Set Enable 64 bit to on.

    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 one of the following log levels that you want to use:

      • NONE
      • DEBUG
      • INFO
      • WARN
      • ERROR

      The log information is generated in the root folder of the Azure Function application.

    6. Click Update Config. The information is saved for the Azure Function.

  6. Restart Azure Function by clicking Restart. When you run your Azure Function, an Instana rewriter is attached to the application, and Instana starts collecting traces.

To view the traces in the Instana UI, open the dashboard of your Azure Function entity and click Upstream/Downstream. Then, you can see traces that are collected for this entity. For more information about viewing traces, see Analyzing traces and calls.

Installing Instana Azure Functions tracers on Docker

To make Instana work in your Azure Function Application, add the following lines to your Dockerfile:

    DOTNET_STARTUP_HOOKS="[AzureWebJobsScriptRoot]/bin/Instana.Tracing.Core.dll" \
    CORECLR_ENABLE_PROFILING=1 \
    CORECLR_PROFILER="{cf0d821e-299b-5307-a3d8-b283c03916dd}" \
    CORECLR_PROFILER_PATH="[AzureWebJobsScriptRoot]/bin/instana_tracing/CoreProfiler.so" \
    INSTANA_ENDPOINT_URL="[Serverless-ingress-URL-for-your-region]" \
    INSTANA_AGENT_KEY="[Your-Instana-agent-key]"

INSTANA_ENDPOINT_URL value depends on your region. For more information, see Endpoints for serverless monitoring documentation.

For more information about setting up Instana in .NET Core, see .NET Core documentation.

Instead of installing and using Instana Nuget packages, Azure Function Application requires that all Instana Nuget packages are copied to the release folder where the application is released on Azure. This is required when Azure Function Application is deployed on Azure using Docker Container option.

For more information about our packages, see .NET Tracing documentation.

Make sure that you are using the latest version by downloading latest Instana.Tracing.Core, Instana.Tracing.Core.Sdk and Instana.Tracing.Core.Rewriter.Linux packages.

After the downloading process is finished, copy the following files to some folders in your Azure Function Application, which is easily accessible from Dockerfile:

  • Instana.Tracing.Core.dll
  • Instana.Tracing.Core.Common.dll
  • Instana.Tracing.Core.Instrumentation.dll
  • Instana.Tracing.Core.Transport.dll
  • Instana.Tracing.Api.dll
  • CoreProfiler.so
  • instrumentation.json

Then, copy these files to the release folder on Azure as follows:

    COPY "/[path-to-your-patch-folder]/Instana.Tracing.Core.dll" "[AzureWebJobsScriptRoot]/bin/Instana.Tracing.Core.dll"
    COPY "/[path-to-your-patch-folder]/Instana.Tracing.Core.Common.dll" "[AzureWebJobsScriptRoot]/bin/Instana.Tracing.Core.Common.dll"
    COPY "/[path-to-your-patch-folder]/Instana.Tracing.Core.Instrumentation.dll" "[AzureWebJobsScriptRoot]/bin/Instana.Tracing.Core.Instrumentation.dll"
    COPY "/[path-to-your-patch-folder]/Instana.Tracing.Core.Transport.dll" "[AzureWebJobsScriptRoot]/bin/Instana.Tracing.Core.Transport.dll"
    COPY "/[path-to-your-patch-folder]/Instana.Tracing.Api.dll" "[AzureWebJobsScriptRoot]/bin/Instana.Tracing.Api.dll"
    COPY "/[path-to-your-patch-folder]/CoreProfiler.so" "[AzureWebJobsScriptRoot]/bin/instana_tracing/CoreProfiler.so"
    COPY "/[path-to-your-patch-folder]/instrumentation.json" "[AzureWebJobsScriptRoot]/bin/instana_tracing/instrumentation.json "                        

Don't install the Instana.Tracing.Core packages directly in your Azure Function Application. The tracing won't work if there are duplicated library files after the application is deployed.

Then, delete the Instana.Tracing.Core packages, and follow the instructions that is already described in this topic for copying library files to the release folder inside your Dockerfile.

Supported triggers

You can find the list of Azure Functions triggers that Instana supports. Some of them are tested so far and the behavior is known. For the rest of them, the instrumentation is still not tested. The following table will be updated as soon as the state changes.

One behavior is seen during testing, that is, if the Azure Function's Run method is STATIC, some missing data is inside the generated span, such as Function name or even Trigger name in case of Queue trigger. The reason for it is if the method is STATIC, Instana instrumentation can not collect all the necessary data about your Run method. You are recommended to use NON-STATIC methods whenever possible.

Trigger Name Tested Visible span data with STATIC methods Visible span data with NON-STATIC methods
Blob Not tested.
CosmosDB Not tested.
Event Grid Not tested.
Event Hub Not tested.
Kafka Not tested.
HTTP Instrumentation works with both STATIC and NON-STATIC methods. Trigger, Method name, Runtime Trigger, Method name, Runtime, Function name
Queue Instrumentation works with only NON-STATIC methods. Method name, Runtime Trigger, Method name, Runtime, Function name
RabbitMQ Not tested.
Service Bus Not tested.
SignalR Not tested.
Table Not tested.
Timer Instrumentation works with both STATIC and NON-STATIC methods. Trigger, Method name, Runtime Trigger, Method name, Runtime, Function name

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.

Then, you can see a host dashboard with all the collected metrics and monitored processes.

Metrics

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

Metric Name Description
Requests The total number of requests regardless of their resulting HTTP status code. For WebApps and FunctionApps.
Bytes Received The count of bytes received by Azure Spring Cloud from the clients.
Bytes Sent The count of bytes sent by Azure Spring Cloud to the clients.
Http101 The count of requests resulting in an HTTP status code 101.
Http2xx The count of requests resulting in an HTTP status code = 200 but < 300.
Http3xx The count of requests resulting in an HTTP status code = 300 but < 400.
Http4xx The count of requests resulting in an HTTP status code = 400 but < 500.
Http5xx The count of requests resulting in an HTTP status code = 500 but < 600.
Memory Working Set The current amount of memory used by the app, in MiB. For WebApps and FunctionApps.
Average Memory Working Set The average amount of memory used by the app, in megabytes (MiB). For WebApps and FunctionApps.
Http Response Time The time taken for the app to serve requests, in seconds. For WebApps and FunctionApps.
IoReadBytesPerSecond The rate at which the app process is reading bytes from I/O operations. For WebApps and FunctionApps.
IoWriteBytesPerSecond The rate at which the app process is writing bytes to I/O operations. For WebApps and FunctionApps.
IoReadOperationsPerSecond The rate at which the app process is issuing read I/O operations. For WebApps and FunctionApps.
IoWriteOperationsPerSecond The rate at which the app process is issuing write I/O operations. For WebApps and FunctionApps.
RequestsInApplicationQueue The number of requests in the application request queue. For WebApps and FunctionApps.
HealthCheckStatus Health check status. For WebApps and FunctionApps.
FileSystemUsage Percentage of filesystem quota consumed by the app. For WebApps and FunctionApps.

Configuration data

FunctionApps

FunctionApp Service Details Description
Id The unique ID for Function App.
Name The name of the FunctionApp instance.
Type The FunctionApp type.
Location The region where the instance is located.
Kind Indicates the type of FunctionApp account.
Subscription The subscription ID of the FunctionApp service instance.
Resource Group The resource group of the FunctionApp service instance.
State Current deployment state of the instance.

Functions

Functions Service Details Description
Id The unique ID for Function.
Name The name of the Functions service instance.
Type Functions Service type.
Location The region where the instance is located.
Subscription The subscription ID of the Functions service instance.
Resource Group The resource group of the Functions service instance.