Class: ManageEngine::Instrumentation::ActionView
- Inherits:
-
Object
- Object
- ManageEngine::Instrumentation::ActionView
- Defined in:
- lib/agent/server/instrument/action_view.rb
Instance Method Summary collapse
-
#collect_data(name, start, finish, payload) ⇒ Object
def instrument.
- #instrument ⇒ Object
- #name ⇒ Object
- #present? ⇒ Boolean
Instance Method Details
#collect_data(name, start, finish, payload) ⇒ Object
def instrument
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/agent/server/instrument/action_view.rb', line 35 def collect_data(name, start, finish, payload) begin if name != 'render_template.action_view' name = "Partial # #{payload[:identifier]}" else name = "Rendering # #{payload[:identifier]}" end tracker = ManageEngine::Tracker::DefaultTracker.new(name, start.to_f * 1000) tracker = ManageEngine::Agent::TrackerHandler.invokeTracker(tracker) if tracker != nil tracker.finish(finish.to_f * 1000) exception = payload[:exception_object] if exception != nil tracker.setError(exception) end ManageEngine::Agent::TrackerHandler.exitTracker(tracker) end rescue Exception => e @obj.log.logException("Error processing #{name} payload", e) end end |
#instrument ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/agent/server/instrument/action_view.rb', line 17 def instrument @obj = ManageEngine::APMObjectHolder.instance @obj.log.info "Instrumenting ActiveView" ActiveSupport::Notifications.subscribe('render_template.action_view') do |name, start, finish, id, payload| collect_data(name, start, finish, payload) end ## subscribe ActiveSupport::Notifications.subscribe('render_partial.action_view') do |name, start, finish, id, payload| collect_data(name, start, finish, payload) end ## subscribe ActiveSupport::Notifications.subscribe('render_collection.action_view') do |name, start, finish, id, payload| collect_data(name, start, finish, payload) end ## subscribe end |
#name ⇒ Object
13 14 15 |
# File 'lib/agent/server/instrument/action_view.rb', line 13 def name 'ActiveView' end |
#present? ⇒ Boolean
9 10 11 |
# File 'lib/agent/server/instrument/action_view.rb', line 9 def present? defined?(::Rails) end |