Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get controller labels from controller, not params #293

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Sep 29, 2023

  1. Get controller labels from controller, not params

    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.
    richardTowers committed Sep 29, 2023
    Configuration menu
    Copy the full SHA
    dc41ee5 View commit details
    Browse the repository at this point in the history