Class: Labkit::Tracing::Rails::ActiveRecord::Subscriber
- Inherits:
-
Object
- Object
- Labkit::Tracing::Rails::ActiveRecord::Subscriber
- Includes:
- TracingCommon
- Defined in:
- lib/labkit/tracing/rails/active_record/subscriber.rb
Overview
ActiveRecord bridges active record notifications to the distributed tracing subsystem
Constant Summary collapse
- ACTIVE_RECORD_NOTIFICATION_TOPIC =
"sql.active_record"
Class Method Summary collapse
-
.instrument ⇒ Object
Instruments Rails ActiveRecord events for opentracing.
Class Method Details
.instrument ⇒ Object
Instruments Rails ActiveRecord events for opentracing. Returns a lambda, which, when called will unsubscribe from the notifications
16 17 18 19 20 |
# 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 |