Skip to content

Add in-build metric for Kestrel rejecting requests #63022

@petrroll

Description

@petrroll

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

Right now, it seems that the kestrel.rejected_connections inbuild metric is only invoked for too many concurrent connections. But there must be other reasons when kestrel rejects connection in a way that it doesn't even reach middlewares.

For that, diagnostic source event has been added in issue #33949 but to the best of my understanding it's not surfaced in any of the inbuild metrics. Metrics which are way easier to surface than diagnostics event.

Describe the solution you'd like

Create parity of then the Microsoft.AspNetCore.Server.Kestrel.BadRequest diagnostic event is emitted and when the metric kestrel.rejected_connections is invoked. Ideally extend the metric with a reason.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsfeature-kestrel

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions