Skip to content

Releases: stephenhillier/starlette_exporter

Option to ignore unhandled paths

20 Nov 04:42
Compare
Choose a tag to compare

This release grants the option to ignore unhandled paths. Use this option to prevent 404 errors from filling up the metrics. See #14.

From README:

filter_unhandled_paths: setting this to True will cause the middleware to ignore requests with unhandled paths (in other words, 404 errors). This helps prevent filling up the metrics with 404 errors and/or intentially bad requests. Default is False.

example:

app.add_middleware(PrometheusMiddleware,
                   filter_unhandled_paths=True, group_paths=True)

Thank you to @mwek for contributing this feature (#15).

Ability to set custom histogram buckets

05 Nov 04:23
Compare
Choose a tag to compare

This release adds a buckets option, which accepts a list of numbers to use as buckets for the histogram. If not set (or set to None), the Prometheus default will be used. (credit to @RyBo)

Convert to ASGI middleware

09 Oct 22:46
Compare
Choose a tag to compare

This release converts the starlette_exporter PrometheusMiddleware to be an ASGI middleware with a __call__ method instead of subclassing BaseHTTPMiddleware (add768e). This fixes an issue that prevents background tasks from being used with the middleware. See encode/starlette#919 (comment) for more information on the BaseHTTPMiddleware issue.

Other improvements:

  • added prefix option, which allows developers to change the prefix of the exported metrics (previously, the metrics would always be prefixed starlette_, which remains the default). See issue #3. (b53bb3f)
  • switched to time.perf_counter() instead of time.time() for request times. (381a4be)

Credit for the improvements in this release goes to @rcoup.

Fix for mounted endpoints/apps when using group_paths

15 Jun 05:08
9f134e8
Compare
Choose a tag to compare

Fix for registry for when using multiprocess

06 Jun 05:49
Compare
Choose a tag to compare

Fixes multiprocess registry (#5 )

Application name included in metrics

22 Apr 04:16
Compare
Choose a tag to compare

The application name can now be specified when creating the middleware:

app.add_middleware(PrometheusMiddleware, app_name="my_app")

This allows filtering metrics by application if you have several FastAPI apps exporting metrics to the same Prometheus service.

Author: @paweldudzinski

v0.2.0 - Group metrics for apps/APIs by their http path

22 Apr 04:01
Compare
Choose a tag to compare

This version provides a group_paths option to the PrometheusMiddleware constructor that will cause all metrics to be grouped by their router path.

This means that requests to endpoints with path variables like /api/v1/shop/1234 and /api/v1/shop/75 will appear in the metrics as /api/v1/shop/{item_id}. This might be helpful if you want metrics organized by HTTP path but don't want them broken down by each individual item in a collection.

Initial PyPI release

28 Oct 01:25
Compare
Choose a tag to compare

Initial release of starlette_exporter with request counter and request duration histogram. Both metrics include the HTTP method, path, and status code. Successful requests/errors can be separated by status code.