tselofan
(Алексей Целиковский)
August 22, 2024, 4:39am
4
The reason was in prometheus-net library. In version 7.0.0 it subscribed to all eventsources in app domain.
namespace Prometheus
{
public sealed class EventCounterAdapterOptions
{
public static readonly EventCounterAdapterOptions Default = new();
/// <summary>
/// By default we subscribe to event counters from all event sources but this allows you to filter by event source name.
/// </summary>
public Func<string, bool> EventSourceFilterPredicate { get; set; } = _ => true;
/// <summary>
/// By default, we subscribe to event counters at Informational level from every event source.
/// You can customize these settings via this callback (with the event source name as the string given as input).
/// </summary>
public Func<string, EventCounterAdapterEventSourceSettings> EventSourceSettingsProvider { get; set; } = _ => new();
public CollectorRegistry Registry { get; set; } = Metrics.DefaultRegistry;
}
}
I upgraded it to version 8 and the problem went away.
/// without just enabling everything under the sky (because .NET has no way to say "enable only the event counters", you have to enable all diagnostic events).
/// </summary>
private static readonly IReadOnlyList<string> DefaultEventSourcePrefixes = new[]
{
"System.Runtime",
"Microsoft-AspNetCore",
"Microsoft.AspNetCore",
"System.Net"
};
public static readonly Func<string, bool> DefaultEventSourceFilterPredicate = name => DefaultEventSourcePrefixes.Any(x => name.StartsWith(x, StringComparison.Ordinal));
}
Thank you for your participation!
1 Like