Skip to content
This repository was archived by the owner on Nov 10, 2024. It is now read-only.
This repository was archived by the owner on Nov 10, 2024. It is now read-only.

[FEATURE] Support alternate output for timing middleware #252

@julyvee

Description

@julyvee

Is your feature request related to a problem? Please describe.
The timing middleware currently always outputs its information as a string, which is supposed to be logged for example. You can define any method that takes a string argument as the callable. But in my case I want to send the timing information to a metrics server and I have to write custom logic to parse this timing information out of the formatted string.

Describe the solution you'd like
I would like alternate options for outputs, for example a data class containing all the timing information and then I would specify a callable which takes this class as an argument.

Describe alternatives you've considered
Alternatively, a string output but in JSON format would be more easily parsable.

Additional context
The JSON format string and support for self defined message formatters was actually already implemented in the original repository, but the PR never got merged: fastapiutils#141

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions