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

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

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

ActiveSupport bridges action active support notifications to the distributed tracing subsystem

Constant Summary collapse

CACHE_READ_TOPIC =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

"cache_read.active_support"
CACHE_GENERATE_TOPIC =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

"cache_generate.active_support"
CACHE_FETCH_HIT_TOPIC =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

"cache_fetch_hit.active_support"
CACHE_WRITE_TOPIC =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

"cache_write.active_support"
CACHE_DELETE_TOPIC =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

"cache_delete.active_support"

Class Method Summary collapse

Class Method Details

.instrumentObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

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