class Labkit::Tracing::Rails::ActionView::ActionViewSubscriber

ActionView bridges action view notifications to the distributed tracing subsystem

Constants

RENDER_COLLECTION_NOTIFICATION_TOPIC
RENDER_PARTIAL_NOTIFICATION_TOPIC
RENDER_TEMPLATE_NOTIFICATION_TOPIC

Public Class Methods

instrument() click to toggle source

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

# File lib/labkit/tracing/rails/action_view/subscriber.rb, line 18
def self.instrument
  subscriptions = [
    ::ActiveSupport::Notifications.subscribe(RENDER_TEMPLATE_NOTIFICATION_TOPIC, RenderTemplateInstrumenter.new),
    ::ActiveSupport::Notifications.subscribe(RENDER_COLLECTION_NOTIFICATION_TOPIC, RenderCollectionInstrumenter.new),
    ::ActiveSupport::Notifications.subscribe(RENDER_PARTIAL_NOTIFICATION_TOPIC, RenderPartialInstrumenter.new),
  ]

  create_unsubscriber subscriptions
end