Skip to content

Double-check for handler mapping in MetricsFilter #7649

Closed
@OrangeDog

Description

@OrangeDog

If any request is dealt with by a filter (e.g. something in the security chain) then it appears in the metrics as unmapped. This makes it hard to see, for example, which endpoints clients keep failing to authenticate with (all of them, or one in particular), or the total number of requests made to an endpoint.

One solution I can see is to inject a HandlerMapping into the filter and add this at the top of getFinalStatus:

try {
    handlerMapping.getHandler(request);
} catch (Exception ignored) { }

This then adds the appropriate attribute if the request would have been mapped to something before a filter dealt with it. As this method is private, I cannot easily just replace this behaviour.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: declinedA suggestion or change that we don't feel we should currently apply

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions