class Datadog::Contrib::Registry

Registry is a collection of integrations.

Constants

Entry

Public Class Methods

new() click to toggle source
# File lib/ddtrace/contrib/registry.rb, line 9
def initialize
  @data = {}
  @mutex = Mutex.new
end

Public Instance Methods

[](name) click to toggle source
# File lib/ddtrace/contrib/registry.rb, line 26
def [](name)
  @mutex.synchronize do
    entry = @data[name]
    entry.klass if entry
  end
end
add(name, klass, auto_patch = false) click to toggle source
# File lib/ddtrace/contrib/registry.rb, line 14
def add(name, klass, auto_patch = false)
  @mutex.synchronize do
    @data[name] = Entry.new(name, klass, auto_patch).freeze
  end
end
each() { |entry| ... } click to toggle source
# File lib/ddtrace/contrib/registry.rb, line 20
def each
  @mutex.synchronize do
    @data.each { |_, entry| yield(entry) }
  end
end
to_h() click to toggle source
# File lib/ddtrace/contrib/registry.rb, line 33
def to_h
  @mutex.synchronize do
    @data.each_with_object({}) do |(_, entry), hash|
      hash[entry.name] = entry.auto_patch
    end
  end
end