Module: Datadog::Contrib::ActiveSupport::Notifications::Event::ClassMethods

Defined in:
lib/ddtrace/contrib/active_support/notifications/event.rb

Overview

Redefines some class behaviors for a Subscriber to make it a bit simpler for an Event.

Instance Method Summary collapse

Instance Method Details

#span_optionsObject



50
51
52
# File 'lib/ddtrace/contrib/active_support/notifications/event.rb', line 50

def span_options
  {}
end

#subscribe(pattern = nil, span_name = nil, options = nil, tracer = nil) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/ddtrace/contrib/active_support/notifications/event.rb', line 34

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

#subscribe!Object



21
22
23
# File 'lib/ddtrace/contrib/active_support/notifications/event.rb', line 21

def subscribe!
  super
end

#subscription(span_name = nil, options = nil, tracer = nil) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/ddtrace/contrib/active_support/notifications/event.rb', line 25

def subscription(span_name = nil, options = nil, tracer = nil)
  super(
    span_name || self.span_name,
    options || span_options,
    tracer || self.tracer,
    &method(:process)
  )
end

#supported?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/ddtrace/contrib/active_support/notifications/event.rb', line 46

def supported?
  true
end

#tracerObject



54
55
56
# File 'lib/ddtrace/contrib/active_support/notifications/event.rb', line 54

def tracer
  Datadog.tracer
end