Request and response body sizes
This release adds new optional request and response body size metrics. They will track the size, in bytes, of request and response bodies received and returned by all endpoints. To enable them, use the `optional_metrics` option:
from starlette_exporter.optional_metrics import response_body_size, request_body_size
app.add_middleware(PrometheusMiddleware, optional_metrics=[response_body_size, request_body_size])
Thank you to intelroman for contributing this feature.
better support for http.HTTPStatus
There is now an option `always_use_int_status` to convert `http.HTTPStatus` codes to integers for the `status_code` metric label. To ensure no breakage for users already working around this behavior, it defaults to `False`.
app.add_middleware(PrometheusMiddleware, always_use_int_status=True)
credit to jgould22 for reporting and fixing this issue.