OpenTelemetry.Instrumentation.Process 1.13.0-beta.1

Process Instrumentation for OpenTelemetry .NET

Status
Stability Beta
Code Owners @Yun-Ting

NuGet version badge NuGet download count badge codecov.io

This is an Instrumentation Library, which instruments .NET and collects telemetry about process behavior.

The process metric instruments being implemented are following OpenTelemetry metrics semantic conventions.

Steps to enable OpenTelemetry.Instrumentation.Process

Step 1: Install package

Add a reference to OpenTelemetry.Instrumentation.Process package.

dotnet add package --prerelease OpenTelemetry.Instrumentation.Process

Add a reference to OpenTelemetry.Exporter.Prometheus.HttpListener package.

dotnet add package --prerelease OpenTelemetry.Exporter.Prometheus.HttpListener

Step 2: Enable Process instrumentation

Process instrumentation should be enabled at application startup using the AddProcessInstrumentation extension on MeterProviderBuilder:

using var meterProvider = Sdk.CreateMeterProviderBuilder()
    .AddProcessInstrumentation()
    .AddPrometheusHttpListener()
    .Build();

Refer to Program.cs for a complete demo. This examples sets up the OpenTelemetry Prometheus exporter, which requires adding the package OpenTelemetry.Exporter.Prometheus.HttpListener to the application.

Additionally, this document shows how to use Prometheus and Grafana to build a dashboard for your application. This is the Grafana dashboard template which has all the metrics currently supported by this package; plus an additional aggregated metric CPU utilization calculated with the raw metrics, CPU time and CPU count.

Please follow the instructions in this document to import a Grafana dashboard by uploading the JSON template file.

Metrics

process.memory.usage

The amount of physical memory allocated for this process.

Units Instrument Type Value Type
By ObservableUpDownCounter Double

The API used to retrieve the value is:

  • Process.WorkingSet64: Gets the amount of physical memory, in bytes, allocated for the associated process.

process.memory.virtual

The amount of committed virtual memory for this process. One way to think of this is all the address space this process can read from without triggering an access violation; this includes memory backed solely by RAM, by a swapfile/pagefile and by other mapped files on disk.

Units Instrument Type Value Type
By ObservableUpDownCounter Double

The API used to retrieve the value is:

process.cpu.time

Total CPU seconds broken down by states.

Units Instrument Type Value Type Attribute Key(s) Attribute Values
s ObservableCounter Double process.cpu.state user, system

The APIs used to retrieve the values are:

process.cpu.count

The number of processors (CPU cores) available to the current process.

Units Instrument Type Value Type
{processors} ObservableUpDownCounter Int32

The API used to retrieve the value is System.Environment.ProcessorCount.

[!NOTE] This metric is under discussion and not part of the Process Metrics Spec at this time.

process.thread.count

Process threads count.

Units Instrument Type Value Type
{thread} ObservableUpDownCounter Int32

The API used to retrieve the value is:

  • Process.Threads: Gets the set of threads that are running in the associated process.

References

No packages depend on OpenTelemetry.Instrumentation.Process.

For detailed changes see: https://github.com/open-telemetry/opentelemetry-dotnet-contrib/blob/71419d08636c05af770247d3e6b70f1151f8845c/src/OpenTelemetry.Instrumentation.Process/CHANGELOG.md.

.NET Standard 2.0

Version Downloads Last updated
1.13.0-beta.1 1 10/24/2025
1.12.0-beta.1 6 06/08/2025
1.11.0-beta.2 17 04/16/2025
1.11.0-beta.1 6 06/08/2025
1.10.0-beta.1 5 06/29/2025
0.5.0-beta.7 7 06/08/2025
0.5.0-beta.6 6 06/08/2025
0.5.0-beta.5 6 06/08/2025
0.5.0-beta.4 5 06/08/2025
0.5.0-beta.3 6 06/08/2025
0.5.0-beta.2 6 06/08/2025
0.5.0-beta.1 6 06/08/2025