From 7e0b274ab92112a0405acca0f9251f5afd914983 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 3 May 2024 17:06:28 -0600 Subject: [PATCH] Fallback to detect controller and action from action_dispatch.request.parameters as symbols --- lib/prometheus_exporter/middleware.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/prometheus_exporter/middleware.rb b/lib/prometheus_exporter/middleware.rb index d2bd1a3..d11b071 100644 --- a/lib/prometheus_exporter/middleware.rb +++ b/lib/prometheus_exporter/middleware.rb @@ -63,8 +63,8 @@ def default_labels(env, result) params = env["action_dispatch.request.parameters"] action = controller = nil if params - action = params["action"] - controller = params["controller"] + action = params["action"] || params[:action] + controller = params["controller"] || params[:controller] elsif (cors = env["rack.cors"]) && cors.respond_to?(:preflight?) && cors.preflight? # if the Rack CORS Middleware identifies the request as a preflight request, # the stack doesn't get to the point where controllers/actions are defined