Skip to content

5.10.0 / 2023-02-27

Compare
Choose a tag to compare
@github-actions github-actions released this 26 Feb 23:34
· 45 commits to master since this release

First release in several months. Includes new features and fixes from various contributors. Notable changes that might have an impact on existing setups is the automatic instrumentation of mounted apps and the deprecation of the lowercase prometheus_multiproc_dir environment variable.

Ask or discuss anything quick about the release in the discussion #221.

Added

  • Added smart handling of mounted apps. Previously the URL handler logic did not handle mounted apps and always returned just the prefix in that case. Based on code from elastic/apm-agent-python licensed under the permissive BSD-3-Clause License. Thanks to @LordGaav for proposing this enhancement / fix and implementing it in #208. Related to issues #31 and #121.

  • Added optional parameters metric_namespace and metric_subsystem to instrument() method to configure namespace and subsystem for all metric names. Check the README.md for more information. Thanks to @phbernardes for proposing this enhancement and implementing it in #193.

  • Added passthrough of body to info.response. This enables metrics that work based on data in the body. Thanks to everyone who brought this up in #76 and to @HadilD for implementing it in #203.

  • Allowed passing a custom registry to be used instead of using the default one. This would be useful in particular when testing multiple FastAPI apps (e.g. microservices) in the same tests run. Note that there are issues with the current implementation in certain corner cases. Thanks to @tiangolo for for proposing this enhancement and implementing it in #153.

  • Environment variable used by should_respect_env_var (default ENABLE_METRICS) now accepts truthy values like 1 and true and not just True. Thanks to @chbndrhnns for proposing this enhancement in #27 and implementing it in #28.

  • Added support for asynchronous instrumentation functions. The add() method now accepts them in addition to "normal" functions and the instrumentator middleware will await them appropriately. Thanks to @AndreasPB for for proposing this enhancement and implementing it in #61. Thanks to @Skeen for contributing to the discussion.

Changed

  • Licensed part of the project under the BSD-3-Clause License. This is due to code being used from a repo licensed under BSD-3-Clause (see the "Added" section). The default ISC License and the BSD-3-Clause License are both permissive. So there should be no user impact.

Fixed

  • Fixed status code in metric being "Hxx" when http.HTTPStatus enumeration is used in combination with grouping of status codes. Thanks to @Leem0sh and others for raising the issue in #190. Thanks to @nikstuckenbrock and @blag for fixing it in #192.

  • Fixed documentation in main README on how to use prometheus-fastapi-instrumentator with current versions of FastAPI. Related to issues #214 and #80. Thanks to @alfaro28 and @harochau.

Deprecated

  • Deprecated environment variable prometheus_multiproc_dir and replaced it with PROMETHEUS_MULTIPROC_DIR. This matches the behavior of the Prometheus Python client library. This fixes #89 and #50. Thanks to all the people who brought this up. Thanks to @michaelusner for implementing the deprecation in #42 / #217.