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.

Constant Summary collapse

DEFAULT_TRACER =
-> { Datadog.tracer }

Instance Method Summary collapse

Instance Method Details

#span_optionsObject



52
53
54
# File 'lib/ddtrace/contrib/active_support/notifications/event.rb', line 52

def span_options
  {}
end

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



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

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



23
24
25
# File 'lib/ddtrace/contrib/active_support/notifications/event.rb', line 23

def subscribe!
  super
end

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



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

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)


48
49
50
# File 'lib/ddtrace/contrib/active_support/notifications/event.rb', line 48

def supported?
  true
end

#tracerObject



56
57
58
# File 'lib/ddtrace/contrib/active_support/notifications/event.rb', line 56

def tracer
  DEFAULT_TRACER
end