Configure Application Insights Profiler for .NET

After you enable Application Insights Profiler for .NET, you can:

  • Start a new profiling session.
  • Configure the .NET Profiler triggers.
  • View recent profiling sessions.

To open the .NET Profiler settings pane, select Performance on the left pane on your Application Insights page.

Screenshot that shows the link to open the Performance pane.

You can view the .NET Profiler traces across your Azure resources via two methods:

  • The Profiler button:

    Select Profiler.

    Screenshot that shows the Profiler button on the Performance pane.

  • Operations:

    1. Select an operation from the Operation name list. Overall is highlighted by default.

    2. Select Profiler traces.

      Screenshot that shows selecting operation and Profiler traces to view all Profiler traces.

    3. Select one of the requests from the list on the left.

    4. Select Configure Profiler.

      Screenshot that shows the overall selection and clicking Profiler traces to view all profiler traces.

Within the Profiler page, you can configure and view the .NET Profiler. The Application Insights Profiler for .NET page has the following features.

Screenshot that shows Profiler page features and settings.

Feature Description
Profile now Starts profiling sessions for all apps that are linked to this instance of Application Insights.
Triggers Allows you to configure triggers that cause the Profiler to run.
Recent profiling sessions Displays information about past profiling sessions, which you can sort by using the filters at the top of the page.

Profile now

Select Profile now to start a profiling session on demand. When you select this link, all Profiler agents that are sending data to this Application Insights instance start to capture a profile. After 5 to 10 minutes, the profile session is shown in the list.

To manually trigger a Profiler session, you need, at minimum, write access on your role for the Application Insights component. In most cases, you get write access automatically. If you're having issues, you need the Application Insights Component Contributor subscription scope role added. For more information, see Roles, permissions, and security in Azure Monitor.

Trigger settings

Select Triggers to open the Trigger Settings pane that has the CPU, Memory, and Sampling trigger tabs.

CPU or Memory triggers

You can set up a trigger to start profiling when the percentage of CPU or memory use hits the level you set.

Screenshot that shows the Trigger Settings pane for C P U and Memory triggers.

Setting Description
On/Off button On: Starts Profiler. Off: Doesn't start Profiler.
Memory threshold When this percentage of memory is in use, Profiler is started.
Duration Sets the length of time Profiler runs when triggered. Default is 30 seconds.
Cooldown Sets the length of time Profiler waits before checking for the memory or CPU usage again after it's triggered.

Sampling trigger

Unlike CPU or Memory triggers, an event doesn't trigger the Sampling trigger. Instead, it's triggered randomly to get a truly random sample of your application's performance. You can:

  • Turn this trigger off to disable random sampling.
  • Set how often profiling occurs and the duration of the profiling session.

Screenshot that shows the Trigger Settings pane for Sampling trigger.

Setting Description
On/Off button On: Starts Profiler. Off: Doesn't start Profiler.
Sample rate The rate at which Profiler can occur.
  • The Normal setting collects data 5% of the time, which is about 2 minutes per hour.
  • The High setting profiles 50% of the time.
  • The Maximum setting profiles 75% of the time.

We recommend the Normal setting for production environments.
Duration Sets the length of time Profiler runs when triggered. Default is 30 seconds.

Recent profiling sessions

This section of the Profiler page displays recent profiling session information. A profiling session represents the time taken by the Profiler agent while profiling one of the machines that hosts your application. Open the profiles from a session by selecting one of the rows. For each session, we show the following settings.

Setting Description
Triggered by How the session was started, either by a trigger, Profile now, or default sampling.
App Name Name of the application that was profiled.
Machine Instance Name of the machine the Profiler agent ran on.
Timestamp Time when the profile was captured.
CPU % Percentage of CPU used while the Profiler was running.
Memory % Percentage of memory used while the Profiler was running.

Next steps

Enable the .NET Profiler and view traces