Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Instrumentation.Runtime] Remove gc.heap.fragmentation.size metrics due to buggy API on .NET 6 #509

Merged
2 changes: 2 additions & 0 deletions src/OpenTelemetry.Instrumentation.Runtime/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

* Change API for GC Heap Size for .NET 6 where the API has a bug
([#495](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/495))
* Remove gc.heap.fragmentation.size metrics due to buggy API on .NET 6
([#509](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/509))

## 1.0.0-rc.1

Expand Down
3 changes: 3 additions & 0 deletions src/OpenTelemetry.Instrumentation.Runtime/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ Note: `ObservableGauge` should be changed to `ObservableUpDownCounter` once avai
as `ObservableUpDownCounter` is the best fit of instrument type. The same applies
to all the `ObservableGauge` below.

Note: `gc.heap.fragmentation.size` metrics is removed for .NET 6 because of a
[bug](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/issues/496).

The APIs used to retrieve the values are:

* [GCMemoryInfo.TotalCommittedBytes](https://docs.microsoft.com/dotnet/api/system.gcmemoryinfo.totalcommittedbytes):
Expand Down
3 changes: 3 additions & 0 deletions src/OpenTelemetry.Instrumentation.Runtime/RuntimeMetrics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ static RuntimeMetrics()
unit: "bytes",
description: "The heap size (including fragmentation), as observed during the latest garbage collection. The value will be unavailable until at least one garbage collection has occurred.");
}
#endif

#if NET7_0_OR_GREATER
utpilla marked this conversation as resolved.
Show resolved Hide resolved
// TODO: Not valid until .NET 7 where the bug is fixed. See context in https://github.com/open-telemetry/opentelemetry-dotnet-contrib/issues/496
// TODO: change to ObservableUpDownCounter
MeterInstance.CreateObservableGauge(
$"{metricPrefix}gc.heap.fragmentation.size",
Expand Down