Skip to content

Metrics logging of request durations for the Prometheus.Client

License

Notifications You must be signed in to change notification settings

prom-client-net/prom-client-httprequestdurations

Repository files navigation

Prometheus.Client.HttpRequestDurations

ci nuget nuget codecov codefactor license

Installation

dotnet add package Prometheus.Client.HttpRequestDurations

Use

There are Examples

app.UsePrometheusRequestDurations(q =>
{
    q.IncludePath = true;
    q.IncludeMethod = true;
    q.IgnoreRoutesConcrete = new[] // Ignore some concrete routes
    {
        "/favicon.ico",
        "/robots.txt",
        "/"
    };
    q.IgnoreRoutesStartWith = new[]
    {
        "/swagger" // Ignore '/swagger/*'
    };
    q.CustomNormalizePath = new Dictionary<Regex, string>
    {
        { new Regex(@"\/[0-9]{1,}(?![a-z])"), "/id" } // Replace 'int' in Route
    };
});

Contribute

Contributions to the package are always welcome!

License

All contents of this package are licensed under the MIT license.