Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

Investigate failures, performance, and transactions with Application Insights

Application Insights collects telemetry from your application to help diagnosing failures and investigating slow transactions. It includes four essential tools:

  • Failures view - Tracks errors, exceptions, and faults, offering clear insights for fast problem-solving and enhanced stability.

  • Performance view - Quickly identifies and helps resolve application bottlenecks by displaying response times and operation counts.

  • Search view - Enables users to locate and examine individual telemetry items such as page views, exceptions, and custom events.

  • Transaction diagnostics - Helps to quickly identify issues in components through comprehensive insight into end-to-end transaction details.

Together, these tools ensure the ongoing health and efficiency of web applications. You can use them to pinpoint issues or enhancements that would have the most impact on users.

To get to the Failures view in Application Insights, select either the Failed requests graph on the Overview pane, or Failures under the Investigate category in the resource menu.

👁 Screenshot showing how to reach the 'Failures' view in Application Insights.

You can also get to the failures view from the Application Map by selecting a resource, then Investigate failures from the triage section.

Note

You can access Transaction diagnostics through any of the other three experiences. For more information, see Investigate telemetry.

Overview

The Failures view shows a list of all failed operations collected for your application with the option to drill into each one. It lets you view their frequency and the number of users affected, to help you focus your efforts on the issues with the highest impact.

👁 Screenshot showing the 'Failures' view in Application Insights.

Note

In addition to the out-of-the-box telemetry sent by the Azure Monitor OpenTelemetry Distro or JavaScript SDK, you can add and modify telemetry (for example, custom events).

For more information, see Add and modify Azure Monitor OpenTelemetry for .NET, Java, Node.js, and Python applications.

Filter telemetry

Default filters

All experiences allow you to filter telemetry by time range. In addition, each experience comes with its own default filter:

You can select which service (Cloud Role Name) or machine/container (Cloud Role Instance) to view from the Roles filter menu. This action allows you to isolate issues or performance trends within specific parts of your application.

To learn how to set the Cloud Role Name and the Cloud Role Instance, see Configure Azure Monitor OpenTelemetry.

Add filters

You can filter events on the values of their properties. The available properties depend on the event or telemetry types you selected. To add a filter:

  1. Select 👁 Filter icon
    to add a filter.

    👁 Filter pill

  2. From the left dropdown list, select a property.

  3. From the center dropdown list, select one of the following operators: =, !=, contains, or not contains.

  4. From the right dropdown list, select all property values you want to filter on.

    Note

    Notice that the counts to the right of the filter values show how many occurrences there are in the current filtered set.

  5. To add another filter, select 👁 Filter icon
    again.

Search telemetry

You can search for specific operations using the Search to filter items... field above the operations list.

👁 Screenshot that shows the 'Search' field.

Use analytics data

All data collected by Application Insights is stored in Log Analytics. It provides a rich query language to analyze the requests that generated the exception you're investigating.

Tip

Simple mode in Log Analytics offers an intuitive point-and-click interface for analyzing and visualizing log data.

  1. On either the performance, failures, or search view, select View in Logs in the top navigation bar and pick a query from the dropdown menu.

    👁 Screenshot of the top action bar with the 'View in logs' button highlighted.

  2. This action takes you to the Logs view, where you can further modify the query or select a different one from the sidebar.

    👁 Screenshot showing the 'Logs' view.

Investigate telemetry

To investigate the root cause of an error or exception, you can drill into the problematic operation for a detailed end-to-end transaction details view that includes dependencies and exception details.

  1. Select an operation to view the Top 3 response codes, Top 3 exception types, and Top 3 failed dependencies for that operation.

  2. Under Drill into, select the button with the number of filtered results to view a list of sample operations.

  3. Select a sample operation to open the End-to-end transaction details view.

    👁 Screenshot showing the 'Failures' view with the 'Drill into' button highlighted.

    Note

    The Suggested samples contain related telemetry from all components, even if sampling is in effect in any of them.

    Tip

    If you need the call stack for a failure, open the related exception in End-to-end transaction details or the Exceptions tab. Stack traces are shown only when exception telemetry was captured for that operation.

Analyze client-side performance and failures

If you instrument your web pages with Application Insights, you can gain visibility into page views, browser operations, and dependencies. Collecting this browser data requires adding a script to your web pages.

  1. After you add the script, you can access page views and their associated performance metrics by selecting the Browser toggle on the Performance or Failures view.

    👁 Screenshot highlighting the 'Server / Browser' toggle below the top action bar.

    This view provides a visual summary of various telemetries of your application from the perspective of the browser.

    Tip

    For single-page applications (SPAs), turn on enableAutoRouteTracking for route changes so that each logical page creates its own page view and operation. Otherwise, multiple route changes can be correlated to a single operation and some page view durations can appear as 0.

  2. For browser operations, the end-to-end transaction details view shows Page View Properties of the client requesting the page, including the type of browser and its location. This information can help determine whether there are performance issues related to particular types of clients.

    👁 Screenshot showing the 'End-to-end transaction details' view with the 'Page View Properties' section highlighted.

Note

Like the data collected for server performance, Application Insights makes all client data available for deep analysis by using logs.

Transaction diagnostics experience

The Transaction diagnostics experience, also called End-to-end transaction details view, shows a Gantt chart of the transaction, which lists all events with their duration and response code.

This diagnostics experience automatically correlates server-side telemetry from across all your Application Insights monitored components into a single view and supports multiple resources. Application Insights detects the underlying relationship and allows you to easily diagnose the application component, dependency, or exception that caused a transaction slowdown or failure.

Selecting a specific event reveals its properties, including additional information like the underlying command or call stack.

This view has four key parts:

👁 Screenshot that shows the transaction view with the results list highlighted.

This collapsible pane shows the other results that meet the filter criteria. Select any result to update the respective details of the preceding three sections. We try to find samples that are most likely to have the details available from all components, even if sampling is in effect in any of them. These samples are shown as suggestions.

Note

The Transaction diagnostics experience now offers a simple view, which shows agent steps in a clear, story-like fashion. For more information, see Monitor AI agents with Application Insights.

Release annotations

Release annotations mark deployments and other significant events on Application Insights charts, allowing correlation of changes with performance, failures, and usage.

Automatic annotations with Azure Pipelines

Azure Pipelines creates a release annotation during deployment when all the following conditions are true:

  • The target resource links to Application Insights through the APPLICATIONINSIGHTS_CONNECTION_STRING app setting.
  • The Application Insights resource is in the same subscription as the target resource.
  • The deployment uses one of the following Azure Pipelines tasks:
Task code Task name Versions
AzureAppServiceSettings Azure App Service Settings Any
AzureRmWebAppDeployment Azure App Service V3+
AzureFunctionApp Azure Functions Any
AzureFunctionAppContainer Azure Functions for container Any
AzureWebAppContainer Azure Web App for Containers Any
AzureWebApp Azure Web App Any

Note

If you still use the older Application Insights annotation deployment task, delete it.

Configure annotations in a pipeline by using an inline script

If you don't use the tasks in the previous section, add an inline script in the deployment stage.

  1. Open an existing pipeline or create a new one, and select a task under Stages.

  2. Add a new Azure CLI task.

  3. Select the Azure subscription. Set Script Type to PowerShell, and set Script Location to Inline.

  4. Add the PowerShell script from step 2 in Create release annotations with the Azure CLI to Inline Script.

  5. Add script arguments. Replace placeholders in angle brackets.

    -aiResourceId "<aiResourceId>" `
    -releaseName "<releaseName>" `
    -releaseProperties @{"ReleaseDescription"="<a description>";
     "TriggerBy"="<Your name>" }
    

    The following example shows metadata you can set in the optional releaseProperties argument by using build and release variables. Select Save.

    -releaseProperties @{
    "BuildNumber"="$(Build.BuildNumber)";
    "BuildRepositoryName"="$(Build.Repository.Name)";
    "BuildRepositoryProvider"="$(Build.Repository.Provider)";
    "ReleaseDefinitionName"="$(Build.DefinitionName)";
    "ReleaseDescription"="Triggered by $(Build.DefinitionName) $(Build.BuildNumber)";
    "ReleaseEnvironmentName"="$(Release.EnvironmentName)";
    "ReleaseId"="$(Release.ReleaseId)";
    "ReleaseName"="$(Release.ReleaseName)";
    "ReleaseRequestedFor"="$(Release.RequestedFor)";
    "ReleaseWebUrl"="$(Release.ReleaseWebUrl)";
    "SourceBranch"="$(Build.SourceBranch)";
    "TeamFoundationCollectionUri"="$(System.TeamFoundationCollectionUri)" }
    

Create release annotations with the Azure CLI

Use the following PowerShell script to create a release annotation from any process, without Azure DevOps.

  1. Sign in to the Azure CLI.

  2. Save the following script as CreateReleaseAnnotation.ps1.

    param(
     [parameter(Mandatory = $true)][string]$aiResourceId,
     [parameter(Mandatory = $true)][string]$releaseName,
     [parameter(Mandatory = $false)]$releaseProperties = @()
    )
    
    # Function to ensure all Unicode characters in a JSON string are properly escaped
    function Convert-UnicodeToEscapeHex {
     param (
     [parameter(Mandatory = $true)][string]$JsonString
     )
     $JsonObject = ConvertFrom-Json -InputObject $JsonString
     foreach ($property in $JsonObject.PSObject.Properties) {
     $name = $property.Name
     $value = $property.Value
     if ($value -is [string]) {
     $value = [regex]::Unescape($value)
     $OutputString = ""
     foreach ($char in $value.ToCharArray()) {
     $dec = [int]$char
     if ($dec -gt 127) {
     $hex = [convert]::ToString($dec, 16)
     $hex = $hex.PadLeft(4, '0')
     $OutputString += "\u$hex"
     }
     else {
     $OutputString += $char
     }
     }
     $JsonObject.$name = $OutputString
     }
     }
     return ConvertTo-Json -InputObject $JsonObject -Compress
    }
    
    $annotation = @{
     Id = [GUID]::NewGuid();
     AnnotationName = $releaseName;
     EventTime = (Get-Date).ToUniversalTime().GetDateTimeFormats("s")[0];
     Category = "Deployment"; #Application Insights only displays annotations from the "Deployment" Category
     Properties = ConvertTo-Json $releaseProperties -Compress
    }
    
    $annotation = ConvertTo-Json $annotation -Compress
    $annotation = Convert-UnicodeToEscapeHex -JsonString $annotation
    
    $accessToken = (az account get-access-token | ConvertFrom-Json).accessToken
    $headers = @{
     "Authorization" = "Bearer $accessToken"
     "Accept" = "application/json"
     "Content-Type" = "application/json"
    }
    $params = @{
     Headers = $headers
     Method = "Put"
     Uri = "https://management.azure.com$($aiResourceId)/Annotations?api-version=2015-05-01"
     Body = $annotation
    }
    Invoke-RestMethod @params
    

Note

Set Category to Deployment or annotations don't appear in the Azure portal.

Call the script and pass values for the parameters. The -releaseProperties parameter is optional.

.\CreateReleaseAnnotation.ps1 `
 -aiResourceId "<aiResourceId>" `
 -releaseName "<releaseName>" `
 -releaseProperties @{"ReleaseDescription"="<a description>";
 "TriggerBy"="<Your name>" }
Argument Definition Note
aiResourceId Resource ID of the target Application Insights resource. Example: /subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/MyRGName/providers/microsoft.insights/components/MyResourceName
releaseName Name of the new release annotation.
releaseProperties Custom metadata to attach to the annotation. Optional

View annotations

Note

Release annotations aren't available in the Metrics pane.

Application Insights displays release annotations in the following experiences:

Annotations are visualized as markers at the top of charts.

👁 A screenshot of the exceptions chart with annotations.

To enable annotations in a workbook, open Advanced Settings and then select Show annotations. Select any annotation marker to open release details such as requestor, source control branch, release pipeline, and environment.

Frequently asked questions

This section provides answers to common questions.

Search view




Transaction diagnostics







Next steps


Feedback

Was this page helpful?

Additional resources