Class: Datadog::Tracing::Contrib::Registry

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/datadog/tracing/contrib/registry.rb

Overview

Registry is a collection of tracing integrations.

Defined Under Namespace

Classes: Entry

Instance Method Summary collapse

Instance Method Details

#[](name) ⇒ Object



35
36
37
38
39
40
# File 'lib/datadog/tracing/contrib/registry.rb', line 35

def [](name)
  @mutex.synchronize do
    entry = @data[name]
    entry.klass if entry
  end
end

#add(name, klass, auto_patch = false) ⇒ Object

Parameters:

  • name (Symbol)

    instrumentation name, to be used when activating this integration

  • klass (Object)

    instrumentation implementation

  • auto_patch (Boolean) (defaults to: false)

    is the tracer allowed to automatically patch the host application with this instrumentation?



23
24
25
26
27
# File 'lib/datadog/tracing/contrib/registry.rb', line 23

def add(name, klass, auto_patch = false)
  @mutex.synchronize do
    @data[name] = Entry.new(name, klass, auto_patch).freeze
  end
end

#each(&block) ⇒ Object



29
30
31
32
33
# File 'lib/datadog/tracing/contrib/registry.rb', line 29

def each(&block)
  @mutex.synchronize do
    @data.each_value(&block)
  end
end

#to_hObject



42
43
44
45
46
47
48
# File 'lib/datadog/tracing/contrib/registry.rb', line 42

def to_h
  @mutex.synchronize do
    @data.each_with_object({}) do |(_, entry), hash|
      hash[entry.name] = entry.auto_patch
    end
  end
end