Skip to content

Commit 9d8ba56

Browse files
committed
Update UPGRADING.md
Add note about improvements to path label generation in `Prometheus::Middleware::Collector`. Signed-off-by: Chris Sinjakli <chris@sinjakli.co.uk>
1 parent 1b159e5 commit 9d8ba56

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

UPGRADING.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ recommends exporting a default value for any time series you know will exist in
140140
For series with no labels, other Prometheus clients (including Go, Java, and Python) do
141141
this automatically, so we have matched that behaviour in the 3.x.x series.
142142

143-
## Path generation fix in Collector middleware
143+
## Added `SCRIPT_NAME` to path labels in Collector middleware
144144

145145
Previously, we did not include `Rack::Request`'s `SCRIPT_NAME` when building paths in
146146
`Prometheus::Middleware::Collector`. We have now added this, which means that any
@@ -151,6 +151,22 @@ This will most typically be present when mounting several Rack applications in t
151151
server process, such as when using [Rails
152152
Engines](https://guides.rubyonrails.org/engines.html).
153153

154+
## Improved stripping of IDs/UUIDs from paths in Collector middleware
155+
156+
Where available (currently for applications written in the Sinatra and Grape frameworks),
157+
we now use framework-specific equivalents to `PATH_INFO` in
158+
`Prometheus::Middleware::Collector`, which means that rather than having path segments
159+
replaced with the generic `:id` and `:uuid` placeholders, you'll see the route as you
160+
defined it in your framework.
161+
162+
For frameworks where that information isn't available to us (most notably Rails), we still
163+
fall back to using `PATH_INFO`, though we have also improved how we strip IDs/UUIDs from
164+
it. Previously, we would only strip them from alternating path segments due to the way we
165+
were matching them. We have improved that matching so it works even when there are
166+
IDs/UUIDs in consecutive path segments.
167+
168+
You may notice the path label change for some of your endpoints.
169+
154170
## Improved validation of label names
155171

156172
Earlier versions of the Ruby Prometheus client performed limited validation of label names

0 commit comments

Comments
 (0)