Runtime metrics compatibility

  • .NET Framework 4.6.1+
  • .NET Core 3.1
  • .NET 5
  • .NET 6
  • .NET 7
  • .NET 8

Automatic configuration

Enable runtime metrics collection in the .NET Tracer 1.23.0+ with the DD_RUNTIME_METRICS_ENABLED=true environment variable.

View runtime metrics in correlation with your .NET services. See the Service Catalog in Datadog.

By default, runtime metrics from your application are sent to the Datadog Agent with DogStatsD over port 8125. Make sure that DogStatsD is enabled for the Agent.

If you are running the Agent as a container, ensure that DD_DOGSTATSD_NON_LOCAL_TRAFFIC is set to true, and that port 8125 is open on the Agent. Additionally, for:

Alternatively, the Agent can ingest metrics with a Unix Domain Socket (UDS) as an alternative to UDP transport. For more information, read DogStatsD over Unix Domain Socket.

Data Collected

The following metrics are collected by default after enabling .NET metrics.

runtime.dotnet.cpu.system
(gauge)
The number of milliseconds executing in the kernel
Shown as millisecond
runtime.dotnet.cpu.user
(gauge)
The number of milliseconds executing outside the kernel
Shown as millisecond
runtime.dotnet.cpu.percent
(gauge)
The percentage of total CPU used by the application
Shown as percent
runtime.dotnet.mem.committed
(gauge)
Memory usage
Shown as byte
runtime.dotnet.threads.count
(gauge)
The number of threads
Shown as thread
runtime.dotnet.threads.workers_count
(gauge)
The number of workers in the threadpool (.NET Core 3.1+ only)
Shown as thread
runtime.dotnet.threads.contention_time
(gauge)
The cumulated time spent by threads waiting on a lock (.NET Core 3.1+ only)
Shown as millisecond
runtime.dotnet.threads.contention_count
(count)
The number of times a thread stopped to wait on a lock
runtime.dotnet.exceptions.count
(count)
The number of first-chance exceptions
Shown as exception
runtime.dotnet.gc.size.gen0
(gauge)
The size of the gen 0 heap
Shown as byte
runtime.dotnet.gc.size.gen1
(gauge)
The size of the gen 1 heap
Shown as byte
runtime.dotnet.gc.size.gen2
(gauge)
The size of the gen 2 heap
Shown as byte
runtime.dotnet.gc.size.loh
(gauge)
The size of the large object heap
Shown as byte
runtime.dotnet.gc.memory_load
(gauge)
The percentage of the total memory used by the process. The GC changes its behavior when this value gets above 85. (.NET Core 3.1+ only)
Shown as percent
runtime.dotnet.gc.pause_time
(gauge)
The amount of time the GC paused the application threads (.NET Core 3.1+ only)
Shown as millisecond
runtime.dotnet.gc.count.gen0
(count)
The number of gen 0 garbage collections
Shown as garbage collection
runtime.dotnet.gc.count.gen1
(count)
The number of gen 1 garbage collections
Shown as garbage collection
runtime.dotnet.gc.count.gen2
(count)
The number of gen 2 garbage collections
Shown as garbage collection
runtime.dotnet.aspnetcore.requests.total
(gauge)
The total number of HTTP requests received by the server (.NET Core 3.1+ only)
Shown as request
runtime.dotnet.aspnetcore.requests.failed
(gauge)
The number of failed HTTP requests received by the server (.NET Core 3.1+ only)
Shown as request
runtime.dotnet.aspnetcore.requests.current
(gauge)
The total number of HTTP requests that have started but not yet stopped (.NET Core 3.1+ only)
Shown as request
runtime.dotnet.aspnetcore.requests.queue_length
(gauge)
The current length of the server HTTP request queue (.NET 5+ only)
Shown as request
runtime.dotnet.aspnetcore.connections.total
(gauge)
The total number of HTTP connections established to the server (.NET 5+ only)
Shown as connection
runtime.dotnet.aspnetcore.connections.current
(gauge)
The current number of active HTTP connections to the server (.NET 5+ only)
Shown as connection
runtime.dotnet.aspnetcore.connections.queue_length
(gauge)
The current length of the HTTP server connection queue (.NET 5+ only)
Shown as connection

Along with displaying these metrics in your APM Service Page, Datadog provides a default .NET Runtime Dashboard.

Additional permissions for IIS

On .NET Framework, metrics are collected using performance counters. Users in non-interactive logon sessions (that includes IIS application pool accounts and some service accounts) must be added to the Performance Monitoring Users group to access counter data.

IIS application pools use special accounts that do not appear in the list of users. To add them to the Performance Monitoring Users group, look for IIS APPPOOL\<name of the pool>. For instance, the user for the DefaultAppPool would be IIS APPPOOL\DefaultAppPool.

This can be done either from the “Computer Management” UI, or from an administrator command prompt:

net localgroup "Performance Monitor Users" "IIS APPPOOL\DefaultAppPool" /add

Further Reading