logging: Record Prometheus metrics
We should use https://github.com/trallnag/prometheus-fastapi-instrumentator to instrument the Web requests.
By default, the instrumentator will expose the following metrics.
- Counter
http_requests_total
with handler, status and method. Total number of requests. - Summary
http_request_size_bytes
with handler. Added up total of the content lengths of all incoming requests. - Summary
http_response_size_bytes
with handler. Added up total of the content lengths of all outgoing responses. - Histogram
http_request_duration_seconds
with handler. Only a few buckets to keep cardinality low. - Histogram
http_request_duration_highr_seconds
without any labels. Large number of buckets (>20).
Edited by Tan Le