Starlette-exporter

Latest version: v0.23.0

Safety actively analyzes 682244 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 3 of 5

0.13.0

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.

0.12.0

Adds support for FastAPI's `root_path` setting, intended for use behind a proxy (for more information about `root_path`, see the FastAPI docs: https://fastapi.tiangolo.com/advanced/behind-a-proxy/). #39

Thanks to Bear1110 for reporting the bug!

0.11.0

v0.11.0 adds a new option `skip_paths` that accepts a list of paths that should be ignored when collecting metrics. This is useful if you don't want to track metrics for health check endpoints or the `/metrics` endpoint.

Example:
python
app.add_middleware(PrometheusMiddleware, skip_paths=['/health']) no metrics will be collected for `/health`


Credit to fdaines for contributing this new feature.

0.10.0

v0.10.0 adds a new default metric `requests_in_progress`.

This metric is a gauge that keeps track of the number of concurrent requests that your application is processing.

Thanks to scotgopal for contributing this feature! :tada:

0.9.0

v0.9.0 now supports mounted routes when using `group_paths=True` and/or `filter_unhandled_paths=True`. Metrics for these routes will now be properly exported with the correct path labels.

Thanks to axyjo for the report (21)!

0.8.2

This update adds support for the uppercase version of the PROMETHEUS_MULTIPROC_DIR env variable, to address a deprecation warning when using the lowercase version. See [Prometheus client_python code](https://github.com/prometheus/client_python/blob/9118c02a9dfee530af9e83924a88be1ac4994bc0/prometheus_client/multiprocess.py#L30).

Thanks to lqhuang. (20)

Page 3 of 5

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.