class AlacrityRails::Probe::Excon

Public Class Methods

activate() click to toggle source
# File lib/alacrity-rails/probe/excon.rb, line 4
def self.activate
  if defined?(::Excon)
    ::Excon.defaults[:instrumentor] = ActiveSupport::Notifications

    ActiveSupport::Notifications.subscribe 'excon.request' do |name, started, finished, unique_id, data|
      AlacrityRails::Client.store_timeline_event(
        name: 'Excon Request',
        event_type: 'http',
        engine: 'Excon',
        started_at: started,
        finished_at: finished,
        detail: "#{data[:scheme]}://#{data[:host]}#{data[:path]}"
      )
    end
  end
end