Sha256: c17e1df76d93fcf0701cedb25caa6b2f6c6df3ec71475bac82d7137b48caa80b
Contents?: true
Size: 1.73 KB
Versions: 61
Compression:
Stored size: 1.73 KB
Contents
require 'ddtrace/contrib/active_support/notifications/subscriber' module Datadog module Contrib module ActiveSupport module Notifications # Defines behaviors for an ActiveSupport::Notifications event. # Compose this into a module or class, then define # #event_name, #span_name, and #process. You can then # invoke Event.subscribe! to more easily subscribe to an event. module Event def self.included(base) base.send(:include, Subscriber) base.send(:extend, ClassMethods) base.send(:on_subscribe) { base.subscribe } end # Redefines some class behaviors for a Subscriber to make # it a bit simpler for an Event. module ClassMethods def subscribe! super end def subscription(span_name = nil, options = nil, tracer = nil) super( span_name || self.span_name, options || span_options, tracer || self.tracer, &method(:process) ) end def subscribe(pattern = nil, span_name = nil, options = nil, tracer = nil) if supported? super( pattern || event_name, span_name || self.span_name, options || span_options, tracer || self.tracer, &method(:process) ) end end def supported? true end def span_options {} end def tracer Datadog.tracer end end end end end end end
Version data entries
61 entries across 61 versions & 2 rubygems