You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[feature request] Opt-in granular GC pause duration per generation in OpenTelemetry.Instrumentation.Runtime #3977
Currently, OpenTelemetry.Instrumentation.Runtime exposes the process.runtime.dotnet.gc.duration metric, which tracks the cumulative GC pause time across the lifetime of the application. While useful for high-level monitoring, it lacks the granularity needed for deep performance tuning. When an application experiences GC-induced latency spikes, knowing the total pause time isn't enough to determine if the culprit is frequent Gen 0 collections or expensive blocking Gen 2 / LOH collections.
What is the expected behavior?
I would like to propose adding an optional, opt-in configuration to OpenTelemetry.Instrumentation.Runtime that captures GC pause duration broken down by generation.
GC.GetTotalPauseDuration() does not expose generation tags, I understand this would likely require an internal EventListener hooked into the Microsoft-Windows-DotNETRuntime provider (tracking GCSuspendEEBegin, GCRestartEEEnd, and GCStart events).
Given the potential overhead of EventListener, this feature would be strictly opt-in via RuntimeMetricsOptions.
This would allow users to slice their telemetry by attributes like:
generation: gen0, gen1, gen2
gc_type: blocking, background
Which alternative solutions or features have you considered?
Relying solely on gc.collections.count: We currently have collection counts by generation, but a high Gen 0 count doesn't necessarily mean high pause times.
Custom EventListener: Users can write their own custom EventListener to track this and export it to OpenTelemetry, but GC pause time by generation is a runtime metric that would greatly benefit the wider ecosystem if included in the official contrib package.
Additional context
As a disabled by default option, I'd love to hear the maintainers' thoughts on whether this architectural tradeoff is acceptable for an opt-in feature.
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.
changed the title [-][feature request] OpenTelemetry.Instrumentation.Runtime[/-][+][feature request] Opt-in granular GC pause duration per generation in OpenTelemetry.Instrumentation.Runtime[/+]on Mar 18, 2026
Activity
[-][feature request] OpenTelemetry.Instrumentation.Runtime[/-][+][feature request] Opt-in granular GC pause duration per generation in OpenTelemetry.Instrumentation.Runtime[/+]Kielek commentedon Mar 19, 2026
I think that this request better suits dotnet/runtime repository. For .NET9+ this package is only listening on the natively provided data: https://learn.microsoft.com/en-us/dotnet/core/diagnostics/built-in-metrics-runtime
If possible, we should not-introduce features into the older frameworks if we are not able to provide them in the newest.
BTW What is your .NET (Framework) version?