module Datadog::Contrib::AutoInstrument

Extensions for auto instrumentation added to the base library AutoInstrumentation enables all integration

Public Class Methods

extended(base) click to toggle source
# File lib/ddtrace/contrib/auto_instrument.rb, line 9
def self.extended(base)
  base.extend(Patch)
end
patch_all() click to toggle source
# File lib/ddtrace/contrib/auto_instrument.rb, line 26
def self.patch_all
  integrations = []

  Contrib::REGISTRY.each do |integration|
    # some instrumentations are automatically enabled when the `rails` instrumentation is enabled,
    # patching them on their own automatically outside of the rails integration context would
    # cause undesirable service naming, so we exclude them based their auto_instrument? setting.
    # we also don't want to mix rspec/cucumber integration in as rspec is env we run tests in.
    next unless integration.klass.auto_instrument?

    integrations << integration.name
  end

  Datadog.configure do |c|
    c.reduce_log_verbosity
    # This will activate auto-instrumentation for Rails
    integrations.each do |integration_name|
      c.use integration_name
    end
  end
end