All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning as well as the Conventional Commits specification.
Only relevant for CI:
dependabot.yml
that daily checks github-actions and pip.
- Bumped lowest required Python version from
3.6.0
to3.6.2
due to Black requirements.
Only relevant for development:
- Updated dev dependencies via
pyproject.toml
- Ran
poetry update
. - Updated all development dependencies to newest (non-conflicting) versions.
- Updated
prometheus-client
dependency version constraint^0.8.0
that only allows versions in the range[0.8.0, 0.9.0[
. This is not correct and leads to conflicts when you want to install the newest prometheus client library version and this package. Switched to explicit contraints to ensure this does not happen again.
- Passthrough of Kwargs to FastAPI route that exposes metrics.
All changes are minor and non-breaking and mostly effect development only.
- Most of the stuff that is not directly related to the code has been replaced with common files / scripts from another repository of mine I use as a kind of template for Python projects you can find here.
- Replaced Makefile with simple Bash script that contains a bunch of functions. Easier to maintain and to use.
- Replace workflow files with new workflows.
- Add
conftest.py
that provides utilities for testing. - Reliscenced from MIT to Apache-2.0.
- Added
DEVELOPMENT.md
. - Introduced MyPy for linting during development.
- Updated docs.
- Parameter
tags
to methodexpose()
. Passthrough to FastAPI to support tagging. Raised by @chisaipete here.
- "Duplicate mime type charset=utf-8 on Response Header" raised by @flobaader in
this issue.
Fixed in commit by changing the
way the content type header is set. Seems like when Starlette's
media_type
parameter is used to provide content type, the charset is appended again automatically even if it already is part ofContent-Type
.
- Run
poetry update
and with that updated a few dependencies.
- New metrics closure
requests
. Idea raised by @jpslopes here.
- Small improvements to docstrings / docs.
- Run
poetry update
.
- Regression introduced in 5.4.1 by pinning FastAPI dependency to
fastapi = "0.38.1, <=1.0.0"
instead offastapi = ">=0.38.1, <=1.0.0"
. Thanks to @PaulFlanaganGenscape for rasing this issue here.
- New metric that monitors the number of requests in progress. Can be
configured to have the labels
handler
andmethod
. It can be activated withshould_instrument_requests_inprogress
and configured withinprogress_name
andinprogress_labels
. Check the autogenerated docs for more info. Implementation not as nice as all the others because the metric requires to be incremented before actually getting the response. This kind of conflicts with the approach of this project. See e62576e3640be0b677334537d27bc267ab0e91cf for the implementation commit.
- Updated a few of the development dependencies to newer versions.
- Updated CI to test with Python 3.9 instead of 3.8.
- Replace deprecated way of creating GitHub environment variables in workflows.
- Update few minor things around the GitHub workflow files.
- Fix for trallnag#9.
The
expose
method in the instrumentator ignores theendpoint
argument and always creates the endpoint with the path/metrics
. Variable was missing. Raised by @funkybase on 2020-09-24.
- Poetry update
- Parameter
should_gzip
toexpose
method will check forgzip
in theAccepted-Encoding
header and gzip the metrics data. You can expect a reduction of around 90 % in bytes.
- Poetry update
- Improvements to the README and updated dev dependencies.
- Work in GitHub Release workflow.
- Fix for trallnag#7.
If a run time error is raised inside the endpoint, FastAPI will not wrap
the error in a response object. In addition this instrumentator assumed
that
info.response
will always contain theheaders
attribute which is not the case if a runtime error is thrown. Now the metrics check if the response isNone
and that theheaders
attribute actually exists. Tests have been added as well.
- Metrics
response_size
andcombined_size
no longer skip if content length is not found. Now the content length will default no zero bytes.
- Parameter
should_only_respect_2xx_for_highr
todefault
metrics. Allows you to only put successful requests into the high resolution bucket.
- Parameters to set namespace and subsystem to all available metrics.
- Rename instrumentation
full
todefault
. - Add labels
handler
,status
,method
tohttp_requests_total
indefault
. - Rename
http_in_bytes_total
tohttp_request_size_bytes
. - Add label
handler
tohttp_request_size_bytes
. - Rename
http_out_bytes_total
tohttp_response_size_bytes
. - Add label
handler
tohttp_response_size_bytes
. - Rename
http_highr_request_duration_seconds
tohttp_request_duration_highr_seconds
. - Rename
http_lowr_request_duration_seconds
tohttp_request_duration_seconds
. - Remove labels
method
andstatus
fromhttp_request_duration_seconds
. - Turn
http_request_size_bytes
andhttp_response_size_bytes
into summaries.
- Refactored available metrics. Made them more modular while improving code structure.
- Switched the default fast track metric to a more advanced one.
- Added proper documentation.
A lot of breaking changes in this release. Prometheus FastAPI Instrumentator is now more modular than before and there are multiple different metrics one can choose from out of the box or add custom metrics that will be automatically applied to the FastAPI.
- If you just use the default instrumentator without setting any parameters, nothing changes. The defaults stay the same.
- If you use any of the paramters that were available in the Instrumentator
constructor you have to check if they are still available or not. Some of
them have been moved to the corresponding
metric
closure / function. I recommend to go through the updated documentation. - Endpoint
/metrics
is not excluded by default anymore. - Updated
README.md
.
- Fixed wrong var name in
README.md
.
- Option to exclude optional
/metrics
endpoint from schema.
- Renamed
should_respect_env_var_existence
toshould_respect_env_var
. - If
should_respect_env_var
isTrue
, the respective env var must betrue
and not just any random value. - Renamed default env var if
should_respect_env_var
fromPROMETHEUS
toENABLE_METRICS
.
- Option
should_respect_env_var_existence
.- This makes it possible to only instrument and expose your FastAPI if a given environment variable is set.
- Usecase: A base FastAPI app that is used by multiple distinct apps. The apps only have to set the variable to be instrumented.
- Deactivated by default and the default env var is
PROMETHEUS
.
- The observed latency values can now be rounded to a certain number of decimals as an opt-in feature. This can improve bytes per sample required in storage solutions like VictoriaMetrics.
- Nothing
- Renamed project from Prometheus FastAPI Exporter to Prometheus FastAPI Instrumentator. Reasoning behind this change: Focus of this project is the instrumentation, not exposition of metrics.
- Updated README.md
- Updated README.md
- Explicit method to expose metrics by adding endpoint to an FastAPI app.
- This changelog document.
- Switch to SemVer versioning.
- Split instrumentation and exposition into two parts. Why? There exist many
ways to expose metrics. Now this package enables the instrumentation of
FastAPI without enforcing a certain method of exposition. It is still
possible with the new method
expose()
. - Moved pass of FastAPI object from constructor to
instrument()
method. - Extended testing.
- Exposition of metrics endpoint from
ìnstrument()
call. - Contribution document. No need for it.
- Nothing