AppMetrics's extension for collect EventCounters data from EventSource's which supports it. E.g. RuntimeEventSource or NpgsqlEventSource
Usage:
dotnet add package Neyro.AppMetrics.Extensions.EventCountersCollector --version 0.0.4
Just add EventCountersCollector as HostedService in your AspNetCore app.
services.AddHostedService(sp => new Neyro.AppMetrics.Extensions.EventCountersCollector(
sp.GetRequiredService<IMetricsRoot>(),
new Neyro.AppMetrics.Extensions.EventCountersCollectorOptions
{
RefreshIntervalSec = 5,
EnabledSources = new[] { "System.Runtime", "Npgsql" }
}
));
Full example here
Nuget package is here
Dashboards for Grafana/Influx: System.Runtime, Npgsql