Monitoring
JetBrains Rider provides an integrated monitoring tool that lets you view various aspects of your application like CPU and memory usage, counters, environment variables, and more. By default, each time you run or debug your project, JetBrains Rider shows the Monitoring tool window with real-time data. Use this window to track the performance of your application and analyze the state of the run environment at a particular moment.
Supported OSs and frameworks
OS: Windows, Linux, macOS
Frameworks: .NET Core 3.0 and later, .NET 5.0 and later
Real-time data
The Monitoring tool window consists of three tabs displaying various real-time data: Chart, Counters, and Environment.
Chart
The Chart tab displays the CPU and memory usage of your application. If you hover over a chart, you can see detailed information about the data points.
The CPU chart shows the CPU usage of your application and exceptions that occur during the run.
The Memory chart shows the memory usage of your application. If you hover over a chart, you can see the detailed information about the size of memory heaps. Garbage collection events are also displayed on the chart.
Counters
The Counters tab displays counters and their values for all enabled counter and metric providers.
Counters
.NET counters are one of the ways to get performance data on your application. Most of the .NET system assemblies provide their own set of counters. For example, the base
System.Runtime
assembly includes such counters as CPU and memory usage, the number of garbage collections in particular heaps, lock contention count, thread pool queue length, and more.Microsoft.AspNetCore.Hosting
provides counters that can be helpful for monitoring server applications: request rate, number of failed requests, and so on. Moreover, your application can provide its own custom counters with the help of EventCounters.Metrics
Metrics is a more modern way to collect application data that supports various third-party providers like OpenTelemetry. .NET assemblies also provide their own set of metrics. For example,
Microsoft.AspNetCore.Hosting
provides metrics for request duration and current number of active requests. As well as counters, your application can provide its own custom metrics.
To add or remove providers, go to Counter providers or Metric providers. When adding a provider:
and configure the list of providers inTo add all counters/metrics from a provider, specify its name, e.g.,
MyProvider
To add specific counters/metrics from a provider, specify the provider and the counter/metric names in the following format:
ProviderName[CounterName1,CounterName2]
. For example,OpenTelemetry.Instrumentation.Runtime[process.runtime.dotnet.gc.collections]
To define how often the counter and metric values must be updated (in seconds), use the Refresh interval parameter in .
Environment
The Environment tab displays environment variables and system properties of your application.
Monitoring modes
By default, monitoring starts automatically when you run or debug your project. You can change this behavior with the Monitoring mode selector in the Monitoring tool window:
Always On – monitoring starts automatically when you run or debug your project.
Only during Debug – monitoring starts automatically only when you debug your project.
Off – monitoring is disabled.
Get profiling data
Sometimes, data collected by the monitoring tool is not enough to analyze the performance of your application. For a more detailed analysis, you can get profiling data (e.g., start a performance profiling session or get a memory snapshot) right from the Monitoring window's toolbar:
Collect stack trace – get a stack trace of the application. The stack trace will be automatically opened in the Stack Trace Explorer. This might be helpful, for example, when you encounter unexpected UI freezes and want to investigate potential thread locks.
Get memory snapshot – instantly get a memory snapshot of your application. Once the snapshot is collected, it will be opened in the dotMemory Profiler tool window.
Start sampling profiling | Start timeline profiling – start a performance profiling session using the timeline or sampling profiling type. To stop recording the profiling data and save a performance snapshot, click the button. The collected snapshots will be opened in the dotTrace Profiler tool window.