Module: Datadog::CI::Contrib::Integration::ClassMethods
- Defined in:
- lib/datadog/ci/contrib/integration.rb
Overview
Class-level methods for Integration
Instance Method Summary collapse
-
#available? ⇒ Boolean
Is the target available to be instrumented? (e.g. gem installed?).
-
#compatible? ⇒ Boolean
Is this instrumentation compatible with the available target? (e.g. minimum version met?).
-
#loaded? ⇒ Boolean
Is the target loaded into the application? (e.g. gem required? Constant defined?).
-
#patchable? ⇒ Boolean
Can the patch for this integration be applied?.
- #register_as(name) ⇒ Object
-
#version ⇒ Object
Version of the integration target code in the environment.
Instance Method Details
#available? ⇒ Boolean
Is the target available to be instrumented? (e.g. gem installed?)
The target doesn’t have to be loaded (e.g. ‘require`) yet, but needs to be able to be loaded before instrumentation can commence.
By default, #available? checks if #version returned a non-nil object.
If the target for instrumentation has concept of versioning, override #version, otherwise override #available? and implement a custom target presence check.
51 52 53 |
# File 'lib/datadog/ci/contrib/integration.rb', line 51 def available? !version.nil? end |
#compatible? ⇒ Boolean
Is this instrumentation compatible with the available target? (e.g. minimum version met?)
67 68 69 |
# File 'lib/datadog/ci/contrib/integration.rb', line 67 def compatible? available? end |
#loaded? ⇒ Boolean
Is the target loaded into the application? (e.g. gem required? Constant defined?)
The target’s objects should be ready to be referenced by the instrumented when loaded returns ‘true`.
61 62 63 |
# File 'lib/datadog/ci/contrib/integration.rb', line 61 def loaded? true end |
#patchable? ⇒ Boolean
Can the patch for this integration be applied?
By default, this is equivalent to #available?, #loaded?, and #compatible? all being truthy.
75 76 77 |
# File 'lib/datadog/ci/contrib/integration.rb', line 75 def patchable? available? && loaded? && compatible? end |
#register_as(name) ⇒ Object
26 27 28 |
# File 'lib/datadog/ci/contrib/integration.rb', line 26 def register_as(name) Integration.register(self, name) end |
#version ⇒ Object
Version of the integration target code in the environment.
This is the gem version, when the instrumentation target is a Ruby gem.
If the target for instrumentation has concept of versioning, override #version, otherwise override #available? and implement a custom target presence check.
37 38 39 |
# File 'lib/datadog/ci/contrib/integration.rb', line 37 def version nil end |