lib/opentelemetry/sdk/trace/tracer_provider.rb in opentelemetry-sdk-0.4.0 vs lib/opentelemetry/sdk/trace/tracer_provider.rb in opentelemetry-sdk-0.5.0

- old
+ new

@@ -11,24 +11,24 @@ class TracerProvider < OpenTelemetry::Trace::TracerProvider Key = Struct.new(:name, :version) private_constant(:Key) attr_accessor :active_trace_config - attr_reader :active_span_processor - attr_reader :stopped + attr_reader :active_span_processor, :stopped, :resource alias stopped? stopped # Returns a new {TracerProvider} instance. # # @return [TracerProvider] - def initialize + def initialize(resource = OpenTelemetry::SDK::Resources::Resource.create) @mutex = Mutex.new @registry = {} @active_span_processor = NoopSpanProcessor.instance @active_trace_config = Config::TraceConfig::DEFAULT @registered_span_processors = [] @stopped = false + @resource = resource end # Returns a {Tracer} instance. # # @param [optional String] name Instrumentation package name @@ -36,10 +36,10 @@ # # @return [Tracer] def tracer(name = nil, version = nil) name ||= '' version ||= '' - @mutex.synchronize { @registry[Key.new(name, version)] ||= Tracer.new(name, version) } + @mutex.synchronize { @registry[Key.new(name, version)] ||= Tracer.new(name, version, self) } end # Attempts to stop all the activity for this {Tracer}. Calls # SpanProcessor#shutdown for all registered SpanProcessors. #