open-telemetry / opentelemetry-dotnet

The OpenTelemetry .NET Client
https://opentelemetry.io
Apache License 2.0
3.23k stars 765 forks source link

ArraySegment ArgumentException in PrometheusCollectionManager on results write #5709

Closed artem-voropaev closed 4 months ago

artem-voropaev commented 4 months ago

Package

OpenTelemetry.Exporter.Prometheus.AspNetCore

Package Version

Package Name Version
OpenTelemetry 1.9.0
OpenTelemetry.Exporter.Prometheus.AspNetCore 1.9.0-beta.1
OpenTelemetry.Extensions.Hosting 1.9.0
OpenTelemetry.Instrumentation.AspNetCore 1.8.1
OpenTelemetry.Instrumentation.Http 1.8.1
OpenTelemetry.Instrumentation.Process 0.5.0-beta.5
OpenTelemetry.Instrumentation.Runtime 1.8.1

Runtime Version

net6.0

Description

On collect metrics exception thrown in PrometheusCollectionManager CallStack: System.ArgumentException: Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection. at System.ArraySegment1..ctor(T[] array, Int32 offset, Int32 count) at OpenTelemetry.Exporter.Prometheus.PrometheusCollectionManager.OnCollect(Batch1 metrics)

Screenshot: image

Steps to Reproduce

See Desc.

Expected Result

Metrics returned

Actual Result

After some time, metrics not returned.

Additional Context

No response

vishweshbankwar commented 4 months ago

https://github.com/open-telemetry/opentelemetry-dotnet/pull/5676 should fix this.

vishweshbankwar commented 4 months ago

https://www.nuget.org/packages/OpenTelemetry.Exporter.Prometheus.AspNetCore/1.9.0-beta.2 has the fix