Skip to content

Commit

Permalink
Use path normalization in collect label builder example
Browse files Browse the repository at this point in the history
  • Loading branch information
grobie committed May 15, 2017
1 parent c43e539 commit d8d76d7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions examples/rack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ use Prometheus::Middleware::Collector, counter_label_builder: ->(env, code) {
{
code: code,
method: env['REQUEST_METHOD'].downcase,
# Include the HTTP Host header as label.
host: env['HTTP_HOST'].to_s,
path: env['PATH_INFO'].to_s,
http_version: env['HTTP_VERSION'].to_s,
# Replace numeric IDs in paths like /users/1234/comments with ':id'.
path: env['PATH_INFO'].to_s.gsub(/\/\d+(\/|$)/, '/:id\\1'),
}
}
```

0 comments on commit d8d76d7

Please sign in to comment.