module Datadog::Contrib::Qless::TracerCleaner

Shutdown Tracer in forks for performance reasons

Public Instance Methods

around_perform(job) click to toggle source
Calls superclass method
# File lib/ddtrace/contrib/qless/tracer_cleaner.rb, line 7
def around_perform(job)
  return super unless datadog_configuration && tracer

  super.tap do
    tracer.shutdown! if forked?
  end
end

Private Instance Methods

datadog_configuration() click to toggle source
# File lib/ddtrace/contrib/qless/tracer_cleaner.rb, line 28
def datadog_configuration
  Datadog.configuration[:qless]
end
forked?() click to toggle source
# File lib/ddtrace/contrib/qless/tracer_cleaner.rb, line 17
def forked?
  pin = Datadog::Pin.get_from(::Qless)
  return false unless pin

  pin.config[:forked] == true
end
tracer() click to toggle source
# File lib/ddtrace/contrib/qless/tracer_cleaner.rb, line 24
def tracer
  datadog_configuration.tracer
end