This repository has been archived by the owner on Nov 10, 2024. It is now read-only.
[FEATURE] Support alternate output for timing middleware #252
Labels
enhancement
New feature or request
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
The text was updated successfully, but these errors were encountered: