class Labkit::Tracing::Rails::ActiveRecord::ActiveRecordSubscriber

ActiveRecord bridges active record notifications to the distributed tracing subsystem

Constants

ACTIVE_RECORD_NOTIFICATION_TOPIC

Public Class Methods

instrument() click to toggle source

Instruments Rails ActiveRecord events for opentracing. Returns a lambda, which, when called will unsubscribe from the notifications

# File lib/labkit/tracing/rails/active_record/subscriber.rb, line 16
def self.instrument
  subscription = ::ActiveSupport::Notifications.subscribe(ACTIVE_RECORD_NOTIFICATION_TOPIC, SqlInstrumenter.new)

  create_unsubscriber [subscription]
end