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

Defined in:
lib/datadog/tracing/contrib/patchable.rb,
sig/datadog/tracing/contrib/patchable.rbs

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.ci.instrument :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)

    can the tracer activate this instrumentation without explicit user input?



102
103
104
# File 'lib/datadog/tracing/contrib/patchable.rb', line 102

def auto_instrument?
  true
end

#patch{ name: untyped, available: untyped, loaded: untyped, compatible: untyped, patchable: untyped }, true

Returns:

  • ({ name: untyped, available: untyped, loaded: untyped, compatible: untyped, patchable: untyped }, true)


80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/datadog/tracing/contrib/patchable.rb', line 80

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

#patcherContrib::Patcher

The patcher module to inject instrumented objects into the instrumentation target.

Datadog::Tracing::Contrib::Patcher includes the basic functionality of a patcher. includeing Datadog::Tracing::Contrib::Patcher into a new module is the recommend way to create a custom patcher.

Returns:



75
76
77
# File 'lib/datadog/tracing/contrib/patchable.rb', line 75

def patcher
  nil
end