Sha256: 54dc16016ab54fb18a6c386d0e19c2d0283f42c2d96784c8e8988eb29c459d33
Contents?: true
Size: 1.31 KB
Versions: 16
Compression:
Stored size: 1.31 KB
Contents
# typed: true module Datadog module Tracing module Contrib # Registry is a collection of tracing integrations. # @public_api class Registry include Enumerable Entry = Struct.new(:name, :klass, :auto_patch) # @!visibility private def initialize @data = {} @mutex = Mutex.new end # @param name [Symbol] instrumentation name, to be used when activating this integration # @param klass [Object] instrumentation implementation # @param auto_patch [Boolean] is the tracer allowed to automatically patch # the host application with this instrumentation? def add(name, klass, auto_patch = false) @mutex.synchronize do @data[name] = Entry.new(name, klass, auto_patch).freeze end end def each(&block) @mutex.synchronize do @data.each_value(&block) end end def [](name) @mutex.synchronize do entry = @data[name] entry.klass if entry end end def to_h @mutex.synchronize do @data.each_with_object({}) do |(_, entry), hash| hash[entry.name] = entry.auto_patch end end end end end end end
Version data entries
16 entries across 16 versions & 1 rubygems