Starlette-exporter

Latest version: v0.22.0

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

Scan your dependencies

Page 1 of 5

0.22.0

* `from_response_header`: a new helper function for adding metric series labels based on HTTP response header values. See the README for more info. Example:

python
from starlette_exporter import PrometheusMiddleware, from_header, from_response_header

app.add_middleware(
PrometheusMiddleware,
labels={
"cache": from_response_header("X-FastAPI-Cache", allowed_values=("hit", "miss"))
}
)


Feedback and bug reports welcome - please open an issue.

0.21.0

You can now access the Request object from an exemplars callback. Example:

python
def exemplars(r: Request):
return {"trace_id": r.headers.get("x-trace-id", "")}

app.add_middleware(
PrometheusMiddleware,
exemplars=exemplars
)


This will allow you to use header values as exemplars. Note that if you want to use OpenTelemetry traces with exemplars, see [this example](https://github.com/stephenhillier/starlette_exporter/issues/90#issuecomment-1913465367).

Thank you backbord (92)!

0.20.0

the `skip_paths` option now accepts regular expressions. 89 bunny-therapist

**Notice:** most usage of skip_paths should be compatible with regex. If your usage is affected by this change, please update to a regular expression or file an issue.

0.19.0

Support for uvicorn v0.26.0's updated root_path behavior (see https://github.com/encode/uvicorn/pull/2213). dolfinus

0.18.0

Changes:
* Fix for handling for `root_path` (see 75 and 81) dolfinus
* Minimum Starlette version now 0.35 and dropped support for Python 3.7 83 dolfinus


Breaking changes:
* `group_paths` and `filter_unhandled_paths` now default to True. See 78 and 79

0.17.1

Add FutureWarnings for group_paths and filter_unhandled_paths indicating that the default values will change next release (see 79 )

Page 1 of 5

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.