Class: Labkit::Tracing::Rails::ActiveSupport::Subscriber

Inherits:
Object
  • Object
show all
Includes:
TracingCommon
Defined in:
lib/labkit/tracing/rails/active_support/subscriber.rb

Overview

ActiveSupport bridges action active support notifications to the distributed tracing subsystem

Constant Summary collapse

CACHE_READ_TOPIC =
"cache_read.active_support"
CACHE_GENERATE_TOPIC =
"cache_generate.active_support"
CACHE_FETCH_HIT_TOPIC =
"cache_fetch_hit.active_support"
CACHE_WRITE_TOPIC =
"cache_write.active_support"
CACHE_DELETE_TOPIC =
"cache_delete.active_support"

Class Method Summary collapse

Class Method Details

.instrumentObject

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



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/labkit/tracing/rails/active_support/subscriber.rb', line 20

def self.instrument
  subscriptions = [
    ::ActiveSupport::Notifications.subscribe(CACHE_READ_TOPIC, CacheReadInstrumenter.new),
    ::ActiveSupport::Notifications.subscribe(CACHE_GENERATE_TOPIC, CacheGenerateInstrumenter.new),
    ::ActiveSupport::Notifications.subscribe(CACHE_FETCH_HIT_TOPIC, CacheFetchHitInstrumenter.new),
    ::ActiveSupport::Notifications.subscribe(CACHE_WRITE_TOPIC, CacheWriteInstrumenter.new),
    ::ActiveSupport::Notifications.subscribe(CACHE_DELETE_TOPIC, CacheDeleteInstrumenter.new),
  ]

  create_unsubscriber subscriptions
end