Skip to content

Optionally skip methods

Compare
Choose a tag to compare
@stephenhillier stephenhillier released this 05 May 18:03
· 62 commits to master since this release

v0.16.0

skip_methods option

This releases adds the skip_methods option, which allows you to avoid recording metrics for any requests with the specified methods. Use this if you do not want certain types of requests (e.g. OPTIONS) to appear in your metrics. The argument should be a list of strings corresponding to method names.

Usage:

app.add_middleware(
  PrometheusMiddleware,
  app_name="hello_world",
  skip_methods=['OPTIONS']
)

Credit to @adinsoon for this new feature.

Bug fixes

Fix for Module "starlette_exporter" does not explicitly export attribute "PrometheusMiddleware" (#63) @poofeg

README fixes: fixed references to the handle_metrics function in example (@elatomo ), and fixed the exemplars example (@camerondavison)