-
Notifications
You must be signed in to change notification settings - Fork 83
Closed
Description
Hi
I'm facing an exception thrown by the ThreadPoolMetricsProducer:
System.Collections.Generic.KeyNotFoundException: The given key '8' was not present in the dictionary.
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Prometheus.DotNetRuntime.Metrics.Producers.ThreadPoolMetricsProducer.<RegisterMetrics>b__29_4(ThreadPoolAdjustedEvent e)
at Prometheus.DotNetRuntime.EventListening.DotNetEventListener.OnEventWritten(EventWrittenEventArgs eventData)
This happens on a dotnet 6 web api application using the prometheus-net.DotNetRuntime version 4.2.3.
The way the collector is initialized:
...
var builder = DotNetRuntimeStatsBuilder.Default();
if (!_options.UseDefaultMetrics)
{
builder = DotNetRuntimeStatsBuilder.Customize()
.WithContentionStats(CaptureLevel.Informational)
.WithGcStats(CaptureLevel.Verbose)
.WithThreadPoolStats(CaptureLevel.Informational)
.WithExceptionStats(CaptureLevel.Errors)
.WithJitStats();
}
builder
.RecycleCollectorsEvery(_options.RecycleEvery)
.WithErrorHandler(ex => _logger.LogError(ex, "Unexpected exception occurred in prometheus-net.DotNetRuntime"));
if (_options.UseDebuggingMetrics)
{
_logger.LogInformation("Using debugging metrics.");
builder.WithDebuggingMetrics(true);
}
_logger.LogInformation("Starting prometheus-net.DotNetRuntime...");
builder.StartCollecting();
...
Metadata
Metadata
Assignees
Labels
No labels