Module: Datadog::Contrib::Patchable::InstanceMethods

Defined in:
lib/ddtrace/contrib/patchable.rb

Overview

Instance methods for integrations

Instance Method Summary collapse

Instance Method Details

#auto_instrument?Boolean

Can the patch for this integration be applied automatically? For example: test integrations should only be applied by the user explicitly setting c.use :rspec and rails sub-modules are auto-instrumented by enabling rails so auto-instrumenting them on their own will cause changes in service naming behavior

Returns:

  • (Boolean)


65
66
67
# File 'lib/ddtrace/contrib/patchable.rb', line 65

def auto_instrument?
  true
end

#patchObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/ddtrace/contrib/patchable.rb', line 44

def patch
  if !self.class.patchable? || patcher.nil?
    return {
      name: self.class.name,
      available: self.class.available?,
      loaded: self.class.loaded?,
      compatible: self.class.compatible?,
      patchable: self.class.patchable?
    }
  end

  patcher.patch
  true
end

#patcherObject



40
41
42
# File 'lib/ddtrace/contrib/patchable.rb', line 40

def patcher
  nil
end