Skip to content

Commit

Permalink
update default values in readme for v0.18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenhillier committed Jan 17, 2024
1 parent 9810ec3 commit b3183e9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ retrieves a value from the `Request` object. [See below](#labels) for examples.

`exemplars`: Optional dict containing label/value pairs. The "value" should be a callback function that returns the desired value at runtime.

`group_paths`: setting this to `True` will populate the path label using named parameters (if any) in the router path, e.g. `/api/v1/items/{item_id}`. This will group requests together by endpoint (regardless of the value of `item_id`). This option may come with a performance hit for larger routers. Default is `False`, which will result in separate metrics for different URLs (e.g., `/api/v1/items/42`, `/api/v1/items/43`, etc.).
`group_paths`: Populate the path label using named parameters (if any) in the router path, e.g. `/api/v1/items/{item_id}`. This will group requests together by endpoint (regardless of the value of `item_id`). As of v0.18.0, the default is `True`, and changing to `False` is highly discouraged (see [warnings about cardinality](https://grafana.com/blog/2022/02/15/what-are-cardinality-spikes-and-why-do-they-matter/)).

`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`.
`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 `True`.

`buckets`: accepts an optional list of numbers to use as histogram buckets. The default value is `None`, which will cause the library to fall back on the Prometheus defaults (currently `[0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1.0, 2.5, 5.0, 7.5, 10.0]`).

Expand All @@ -106,7 +106,6 @@ app.add_middleware(
labels={
"server_name": os.getenv("HOSTNAME"),
}),
group_paths=True,
buckets=[0.1, 0.25, 0.5],
skip_paths=['/health'],
skip_methods=['OPTIONS'],
Expand Down

0 comments on commit b3183e9

Please sign in to comment.