lib/agent/server/instrument/rails.rb in site24x7_apminsight-1.9.0 vs lib/agent/server/instrument/rails.rb in site24x7_apminsight-1.9.1

- old
+ new

@@ -22,17 +22,22 @@ def name 'Rails' end + # https://edgeguides.rubyonrails.org/active_support_instrumentation.html#rails-framework-hooks + def instrument @obj = ManageEngine::APMObjectHolder.instance @obj.log.info "Instrumenting ActionController.. Rails Version: #{version}" @railsTracker = nil ActiveSupport::Notifications.subscribe('start_processing.action_controller') do |name, start, finish, id, payload| path = payload[:path].partition("?")[0] + # request = payload[:request] + # request.original_url => returns http://www.example.com/articles?page=2 + # request.request_method @railsTracker = ManageEngine::Tracker::RootTracker.new("#{payload[:controller]}.#{payload[:action]}", start.to_f * 1000) @railsTracker.url=(path) @railsTracker = ManageEngine::Agent::TrackerHandler.invokeTracker(@railsTracker) end # subscribe @@ -41,9 +46,10 @@ if @railsTracker != nil @railsTracker.finish(finish.to_f * 1000) exception = payload[:exception_object] if exception != nil @railsTracker.setError(exception) + # TODO: payload[:status] @railsTracker.setStatus(500) # By default, set 500 as status for error txns end ManageEngine::Agent::TrackerHandler.exitTracker(@railsTracker) end end \ No newline at end of file