Commit 2f1e7e9
authored
Get controller labels from controller, not params (#293)
prometheus_exporter currently reads the controller and action label from
action_dispatch.request.parameters. This can lead to conflicts, where
there's a form parameter called "action", or "controller" which takes
precedence over "which controller action is this?".
This can be validated with a curl request to a rails application
instrumented with prometheus_exporter:
curl -v http://127.0.0.1:3000/ --data 'controller=test'
Results in:
# HELP http_requests_total Total HTTP requests from web app.
# TYPE http_requests_total counter
http_requests_total{action="other",controller="test",status="404"} 1
This commit pulls the controller instance from `action_controller.instance`,
and then calls the controller_name / action_name methods, which should
be accurate even when conflicting form parameters are provided.1 parent 236bf09 commit 2f1e7e9
1 file changed
+4
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
78 | 78 | | |
79 | | - | |
80 | | - | |
81 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| |||
0 commit comments