Starlette¶
aiodogstatsd
library can be easily used with Starlette
web framework by using client and middleware provided.
At first you need to install aiodogstatsd
with required extras:
1 |
|
Then you can use code below as is to get initialized client and middleware:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
Optionally you can provide additional configuration to the middleware:
request_duration_metric_name
— name of request duration metric (default:http_request_duration
);collect_not_allowed
— collect or not405 Method Not Allowed
responses;collect_not_found
— collect or not404 Not Found
responses.