Skip to content

Support ignoring request paths with regular-expression patterns #255

@rovazh

Description

@rovazh

Current Situation

When an application uses the standard net/http mux, every request whose path is not listed in IgnoredPaths is recorded.
Servers are frequently hit by automated scanners, health-checkers, or other unpredictable clients. These one-off paths continuously create new Prometheus time-series, causing unbounded cardinality growth.

Problem

Because the paths are effectively random (e.g. /.git/config, /favicon_123.ico, …), it is not feasible to maintain an exhaustive IgnoredPaths list.

Proposed Solution

Add a new configuration field to the middleware factory:

// IgnoredPathRegexps is a list of regular expression path patterns that will not be
// measured for the request duration and the response size. They will still be counted
// in the RequestsInflight metric.
IgnoredPathRegexps []string

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions