Skip to content

7.0.0 / 2024-03-13

Latest
Compare
Choose a tag to compare
@github-actions github-actions released this 13 Mar 16:39
· 1 commit to master since this release

Major release with a single breaking change: Python 3.7 is not supported anymore. Beyond that, three improvements based on various pull requests.

Added

  • Instrumentator now works without FastAPI. This is possible because every FastAPI app is also a Starlette app (but not the other way around). Or to be more specific: FastAPI uses Starlette for things like routing and middleware this package relies on. The change is backwards compatible, even type checkers like mypy should continue working. Thanks to @mvanderlee for proposing this in #280 and implementing it in #288.

  • Middleware also records duration without streaming in addition to the already existing total latency (i.e. the time consumed for streaming is not included in the duration value). The differentiation can be valuable as it shows the time to first byte.

    This mode is opt-in and can be enabled / used in several ways: The Instrumentator() constructor, the metrics.default() closure, and the metrics.latency() closure now come with the flag should_exclude_streaming_duration. The attribute modified_duration_without_streaming has been added to the metrics.Info class. Instances of metrics.Info are passed to instrumentation functions, where the added value can be used to set metrics.

    Thanks to @dosuken123 for proposing this in #291 and implementing it in #290.

  • Relaxed type of get_route_name() argument to HTTPConnection. This allows developers to use the get_route_name function for getting the name of websocket routes as well. Thanks to @pajowu for proposing and implementing this feature in #276.

Removed

  • BREAKING: Dropped support for Python 3.7 which is has reached end-of-life.