diff --git a/lib/prometheus/middleware/collector.rb b/lib/prometheus/middleware/collector.rb index 65de3d17..dddc8ed8 100644 --- a/lib/prometheus/middleware/collector.rb +++ b/lib/prometheus/middleware/collector.rb @@ -67,15 +67,17 @@ def trace(env) end def record(env, code, duration) + path = env[Rack::SCRIPT_NAME] + env[Rack::PATH_INFO] + counter_labels = { code: code, method: env['REQUEST_METHOD'].downcase, - path: strip_ids_from_path(env['PATH_INFO']), + path: strip_ids_from_path(path), } duration_labels = { method: env['REQUEST_METHOD'].downcase, - path: strip_ids_from_path(env['PATH_INFO']), + path: strip_ids_from_path(path), } @requests.increment(labels: counter_labels)