Live Metrics: Monitor & Diagnose with 1-second latency

Monitor your live, in-production web application by using Live Metrics (also known as QuickPulse) from Application Insights. Select and filter metrics and performance counters to watch in real time, without any disturbance to your service. Inspect stack traces from sample failed requests and exceptions. Together with Profiler and Snapshot debugger, Live Metrics provides a powerful and non-invasive diagnostic tool for your live website.

Note

Live Metrics only supports TLS 1.2. For more information, refer to Troubleshooting.

With Live Metrics, you can:

  • Validate a fix while it's released, by watching performance and failure counts.
  • Watch the effect of test loads, and diagnose issues live.
  • Focus on particular test sessions or filter out known issues, by selecting and filtering the metrics you want to watch.
  • Get exception traces as they happen.
  • Experiment with filters to find the most relevant KPIs.
  • Monitor any Windows performance counter live.
  • Easily identify a server that is having issues, and filter all the KPI/live feed to just that server.

Live Metrics tab

Live Metrics are currently supported for ASP.NET, ASP.NET Core, Azure Functions, Java, and Node.js apps.

Note

The number of monitored server instances displayed by Live Metrics may be lower than the actual number of instances allocated for the application. This is because many modern web servers will unload applications that do not receive requests over a period of time in order to conserve resources. Since Live Metrics only counts servers that are currently running the application, servers that have already unloaded the process will not be included in that total.

Get started

  1. Follow language specific guidelines to enable Live Metrics.

  2. In the Azure portal, open the Application Insights resource for your app, then open Live Stream.

  3. Secure the control channel if you might use sensitive data such as customer names in your filters.

Important

Monitoring ASP.NET Core LTS applications require Application Insights version 2.8.0 or above. To enable Application Insights ensure it is both activated in the Azure Portal and that the Application Insights NuGet package is included. Without the NuGet package some telemetry is sent to Application Insights but that telemetry will not show in Live Metrics.

Note

On March 31, 2025, support for instrumentation key ingestion will end. Instrumentation key ingestion will continue to work, but we'll no longer provide updates or support for the feature. Transition to connection strings to take advantage of new capabilities.

Enable Live Metrics using code for any .NET application

Note

Live Metrics is enabled by default when onboarding using the recommended instructions for .NET Applications.

How to manually set up Live Metrics:

  1. Install the NuGet package Microsoft.ApplicationInsights.PerfCounterCollector
  2. The following sample console app code shows setting up Live Metrics.
using Microsoft.ApplicationInsights;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse;
using System;
using System.Threading.Tasks;

namespace LiveMetricsDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            // Create a TelemetryConfiguration instance.
            TelemetryConfiguration config = TelemetryConfiguration.CreateDefault();
            config.InstrumentationKey = "INSTRUMENTATION-KEY-HERE";
            QuickPulseTelemetryProcessor quickPulseProcessor = null;
            config.DefaultTelemetrySink.TelemetryProcessorChainBuilder
                .Use((next) =>
                {
                    quickPulseProcessor = new QuickPulseTelemetryProcessor(next);
                    return quickPulseProcessor;
                })
                .Build();

            var quickPulseModule = new QuickPulseTelemetryModule();

            // Secure the control channel.
            // This is optional, but recommended.
            quickPulseModule.AuthenticationApiKey = "YOUR-API-KEY-HERE";
            quickPulseModule.Initialize(config);
            quickPulseModule.RegisterTelemetryProcessor(quickPulseProcessor);

            // Create a TelemetryClient instance. It is important
            // to use the same TelemetryConfiguration here as the one
            // used to setup Live Metrics.
            TelemetryClient client = new TelemetryClient(config);

            // This sample runs indefinitely. Replace with actual application logic.
            while (true)
            {
                // Send dependency and request telemetry.
                // These will be shown in Live Metrics.
                // CPU/Memory Performance counter is also shown
                // automatically without any additional steps.
                client.TrackDependency("My dependency", "target", "http://sample",
                    DateTimeOffset.Now, TimeSpan.FromMilliseconds(300), true);
                client.TrackRequest("My Request", DateTimeOffset.Now,
                    TimeSpan.FromMilliseconds(230), "200", true);
                Task.Delay(1000).Wait();
            }
        }
    }
}

While the above sample is for a console app, the same code can be used in any .NET applications. If any other TelemetryModules are enabled which auto-collects telemetry, it's important to ensure the same configuration used for initializing those modules is used for Live Metrics module as well.

How does Live Metrics differ from Metrics Explorer and Analytics?

Live Stream Metrics Explorer and Analytics
Latency Data displayed within one second Aggregated over minutes
No retention Data persists while it's on the chart, and is then discarded Data retained for 90 days
On demand Data is only streamed while the Live Metrics pane is open Data is sent whenever the SDK is installed and enabled
Free There's no charge for Live Stream data Subject to pricing
Sampling All selected metrics and counters are transmitted. Failures and stack traces are sampled. Events may be sampled
Control channel Filter control signals are sent to the SDK. We recommend you secure this channel. Communication is one way, to the portal

Select and filter your metrics

(Available with ASP.NET, ASP.NET Core, and Azure Functions (v2).)

You can monitor custom KPI live by applying arbitrary filters on any Application Insights telemetry from the portal. Select the filter control that shows when you mouse-over any of the charts. The following chart is plotting a custom Request count KPI with filters on URL and Duration attributes. Validate your filters with the Stream Preview section that shows a live feed of telemetry that matches the criteria you've specified at any point in time.

Filter request rate

You can monitor a value different from Count. The options depend on the type of stream, which could be any Application Insights telemetry: requests, dependencies, exceptions, traces, events, or metrics. It can be your own custom measurement:

Query builder on request rate with custom metric

In addition to Application Insights telemetry, you can also monitor any Windows performance counter by selecting that from the stream options, and providing the name of the performance counter.

Live Metrics are aggregated at two points: locally on each server, and then across all servers. You can change the default at either by selecting other options in the respective drop-downs.

Sample Telemetry: Custom Live Diagnostic Events

By default, the live feed of events shows samples of failed requests and dependency calls, exceptions, events, and traces. Select the filter icon to see the applied criteria at any point in time.

Filter button

As with metrics, you can specify any arbitrary criteria to any of the Application Insights telemetry types. In this example, we're selecting specific request failures, and events.

Query Builder

Note

Currently, for Exception message-based criteria, use the outermost exception message. In the preceding example, to filter out the benign exception with inner exception message (follows the "<--" delimiter) "The client disconnected." use a message not-contains "Error reading request content" criteria.

See the details of an item in the live feed by clicking it. You can pause the feed either by clicking Pause or simply scrolling down, or clicking an item. Live feed will resume after you scroll back to the top, or by clicking the counter of items collected while it was paused.

Screenshot shows the Sample telemetry window with an exception selected and the exception details displayed at the bottom of the window.

Filter by server instance

If you want to monitor a particular server role instance, you can filter by server. To filter, select the server name under Servers.

Sampled live failures

Secure the control channel

Live Metrics custom filters allow you to control which of your application's telemetry is streamed to the Live Metrics view in Azure portal. The filters criteria is sent to the apps that are instrumented with the Application Insights SDK. The filter value could potentially contain sensitive information such as CustomerID. To keep this value secured and prevent potential disclosure to unauthorized applications, you have two options:

  • Recommended: Secure Live Metrics channel using Azure AD authentication
  • Legacy (no longer recommended): Set up an authenticated channel by configuring a secret API key as explained below

It is possible to try custom filters without having to set up an authenticated channel. Simply click on any of the filter icons and authorize the connected servers. Notice that if you choose this option, you will have to authorize the connected servers once every new session or when a new server comes online.

Warning

We strongly discourage the use of unsecured channels and will disable this option 6 months after you start using it. The “Authorize connected servers” dialog displays the date (highlighted below) after which this option will be disabled.

Screenshot displaying the 'authorize connected servers' dialog.

Legacy option: Create API key

API key > Create API key Create API Key tab. Select "authenticate SDK control channel" then "generate key"

Add API key to Configuration

ASP.NET

In the applicationinsights.config file, add the AuthenticationApiKey to the QuickPulseTelemetryModule:

<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse.QuickPulseTelemetryModule, Microsoft.AI.PerfCounterCollector">
      <AuthenticationApiKey>YOUR-API-KEY-HERE</AuthenticationApiKey>
</Add>

ASP.NET Core

For ASP.NET Core applications, follow the instructions below.

Modify ConfigureServices of your Startup.cs file as follows:

Add the following namespace.

using Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse;

Then modify ConfigureServices method as below.

public void ConfigureServices(IServiceCollection services)
{
    // existing code which include services.AddApplicationInsightsTelemetry() to enable Application Insights.
    services.ConfigureTelemetryModule<QuickPulseTelemetryModule> ((module, o) => module.AuthenticationApiKey = "YOUR-API-KEY-HERE");
}

More information on configuring ASP.NET Core applications can be found in our guidance on configuring telemetry modules in ASP.NET Core.

WorkerService

For WorkerService applications, follow the instructions below.

Add the following namespace.

using Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse;

Next, add the following line before the call services.AddApplicationInsightsTelemetryWorkerService.

    services.ConfigureTelemetryModule<QuickPulseTelemetryModule> ((module, o) => module.AuthenticationApiKey = "YOUR-API-KEY-HERE");

More information on configuring WorkerService applications can be found in our guidance on configuring telemetry modules in WorkerServices.

Azure Function Apps

For Azure Function Apps (v2), securing the channel with an API key can be accomplished with an environment variable.

Create an API key from within your Application Insights resource and go to Settings > Configuration for your Function App. Select New application setting and enter a name of APPINSIGHTS_QUICKPULSEAUTHAPIKEY and a value that corresponds to your API key.

Supported features table

Language Basic Metrics Performance metrics Custom filtering Sample telemetry CPU split by process
.NET Framework Supported (LTS) Supported (LTS) Supported (LTS) Supported (LTS) Supported (LTS)
.NET Core (target=.NET Framework) Supported (LTS) Supported (LTS) Supported (LTS) Supported (LTS) Supported (LTS)
.NET Core (target=.NET Core) Supported (LTS) Supported* Supported (LTS) Supported (LTS) Not Supported
Azure Functions v2 Supported Supported Supported Supported Not Supported
Java Supported (V2.0.0+) Supported (V2.0.0+) Not Supported Supported (V3.2.0+) Not Supported
Node.js Supported (V1.3.0+) Supported (V1.3.0+) Not Supported Supported (V1.3.0+) Not Supported

Basic metrics include request, dependency, and exception rate. Performance metrics (performance counters) include memory and CPU. Sample telemetry shows a stream of detailed information for failed requests and dependencies, exceptions, events, and traces.

* PerfCounters support varies slightly across versions of .NET Core that do not target the .NET Framework:

  • PerfCounters metrics are supported when running in Azure App Service for Windows. (AspNetCore SDK Version 2.4.1 or higher)
  • PerfCounters are supported when app is running in ANY Windows machines (VM or Cloud Service or on-premises etc.) (AspNetCore SDK Version 2.7.1 or higher), but for apps targeting .NET Core LTS or higher.
  • PerfCounters are supported when app is running ANYWHERE (Linux, Windows, app service for Linux, containers, etc.) in the latest versions, but only for apps targeting .NET Core LTS or higher.

Troubleshooting

Live Metrics uses different IP addresses than other Application Insights telemetry. Make sure those IP addresses are open in your firewall. Also check the outgoing ports for Live Metrics are open in the firewall of your servers.

As described in the Azure TLS 1.2 migration announcement, Live Metrics now only supports TLS 1.2. If you are using an older version of TLS, Live Metrics will not display any data. For applications based on .NET Framework 4.5.1, refer to How to enable Transport Layer Security (TLS) 1.2 on clients - Configuration Manager to support newer TLS version.

Warning

Currently, authenticated channel only supports manual SDK instrumentation. The authenticated channel cannot be configured with auto-instrumentation (used to be known as "codeless attach").

Missing configuration for .NET

  1. Verify you are using the latest version of the NuGet package Microsoft.ApplicationInsights.PerfCounterCollector
  2. Edit the ApplicationInsights.config file
    • Verify that the connection string points to the Application Insights resource you are using
    • Locate the QuickPulseTelemetryModule configuration option; if it is not there, add it
    • Locate the QuickPulseTelemetryProcessor configuration option; if it is not there, add it
<TelemetryModules>
<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.
QuickPulse.QuickPulseTelemetryModule, Microsoft.AI.PerfCounterCollector"/>
</TelemetryModules>

<TelemetryProcessors>
<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.
QuickPulse.QuickPulseTelemetryProcessor, Microsoft.AI.PerfCounterCollector"/>
<TelemetryProcessors>
  1. Restart the application

Next steps