Skip to content

Add elapsedMs parameter to the EnrichDiagnosticContext delegate #389

Open
@jmenziessmith

Description

@jmenziessmith

Is your feature request related to a problem? Please describe.
I want to use the diagnostic context to log a structured object containing enhanced request information. I would like this to include the elapsed duration, but the value is not accessible outside of the middleware. I believe this is a simple fix, to just include the elapsedMs value as a parameter to the EnrichDiagnosticContext action.

Describe the solution you'd like

RequestLoggingMiddleware.cs#L30

readonly Action<IDiagnosticContext, HttpContext>? _enrichDiagnosticContext; // current
readonly Action<IDiagnosticContext, HttpContext, double>? _enrichDiagnosticContext; // proposed

RequestLoggingMiddleware.cs#L85

_enrichDiagnosticContext?.Invoke(_diagnosticContext, httpContext); // current
_enrichDiagnosticContext?.Invoke(_diagnosticContext, httpContext, elapsedMs); // proposed

Describe alternatives you've considered
n/a

Additional context
n/a

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions