How can I monitor an ActionController::Metal with NewRelic?
-
12-03-2021 - |
Frage
I have a Rails 3 application of which some controllers are normal rails controllers and some are implemented using ActionController::Metal. By default, NewRelic monitors the normal rails controllers but not the NewRelic ones.
It seems that NewRelic supports Rack applications, but the code examples given are either when there is a specific piece of middleware you want to monitor, or when you have a MetalApp you are defining. Neither seems to work with ActionController::Metal.
So, how do I add NewRelic monitoring to my metal controllers?
Lösung
New Relic support suggested:
class SteelController < ActionController::Metal
include ActionController::Rendering
def show
render :text => { :data => 1 }.to_json
end
include NewRelic::Agent::Instrumentation::ControllerInstrumentation
add_transaction_tracer :show
end
which seems to work.
Andere Tipps
Have you asked New Relic support?
I believe you can use: http://newrelic.com/docs/docs/custom-metric-collection
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow