lib/opentelemetry/sdk/configurator.rb in opentelemetry-sdk-0.5.1 vs lib/opentelemetry/sdk/configurator.rb in opentelemetry-sdk-0.6.0

- old
+ new

@@ -13,36 +13,37 @@ USE_MODE_ONE = 1 USE_MODE_ALL = 2 private_constant :USE_MODE_UNSPECIFIED, :USE_MODE_ONE, :USE_MODE_ALL - attr_writer :logger, :http_extractors, :http_injectors, :text_extractors, - :text_injectors + attr_writer :logger, :http_extractors, :http_injectors, :text_map_extractors, + :text_map_injectors def initialize @instrumentation_names = [] @instrumentation_config_map = {} @http_extractors = nil @http_injectors = nil - @text_extractors = nil - @text_injectors = nil + @text_map_extractors = nil + @text_map_injectors = nil @span_processors = [] @use_mode = USE_MODE_UNSPECIFIED @resource = Resources::Resource.telemetry_sdk end def logger - @logger ||= Logger.new(STDOUT) + @logger ||= OpenTelemetry.logger end # Accepts a resource object that is merged with the default telemetry sdk # resource. The use of this method is optional, and is provided as means - # to add additional resource information. + # to include additional resource information. + # If a resource key collision occurs the passed in resource takes priority. # # @param [Resource] new_resource The resource to be merged def resource=(new_resource) - @resource = @resource.merge(new_resource) + @resource = new_resource.merge(@resource) end # Install an instrumentation with specificied optional +config+. # Use can be called multiple times to install multiple instrumentation. # Only +use+ or +use_all+, but not both when installing @@ -87,11 +88,11 @@ # - setup propagation # - setup tracer_provider and meter_provider # - install instrumentation def configure OpenTelemetry.logger = logger - OpenTelemetry.correlations = CorrelationContext::Manager.new + OpenTelemetry.baggage = Baggage::Manager.new configure_propagation configure_span_processors OpenTelemetry.tracer_provider = tracer_provider install_instrumentation end @@ -128,12 +129,12 @@ end def configure_propagation OpenTelemetry.propagation.http = create_propagator(@http_injectors || default_http_injectors, @http_extractors || default_http_extractors) - OpenTelemetry.propagation.text = create_propagator(@text_injectors || default_text_injectors, - @text_extractors || default_text_extractors) + OpenTelemetry.propagation.text = create_propagator(@text_map_injectors || default_text_map_injectors, + @text_map_extractors || default_text_map_extractors) end def create_propagator(injectors, extractors) if injectors.size > 1 || extractors.size > 1 Context::Propagation::CompositePropagator.new(injectors, extractors) @@ -141,30 +142,30 @@ Context::Propagation::Propagator.new(injectors, extractors) end end def default_http_injectors - default_text_injectors + default_text_map_injectors end def default_http_extractors [ OpenTelemetry::Trace::Propagation::TraceContext.rack_extractor, - OpenTelemetry::CorrelationContext::Propagation.rack_extractor + OpenTelemetry::Baggage::Propagation.rack_extractor ] end - def default_text_injectors + def default_text_map_injectors [ - OpenTelemetry::Trace::Propagation::TraceContext.text_injector, - OpenTelemetry::CorrelationContext::Propagation.text_injector + OpenTelemetry::Trace::Propagation::TraceContext.text_map_injector, + OpenTelemetry::Baggage::Propagation.text_map_injector ] end - def default_text_extractors + def default_text_map_extractors [ - OpenTelemetry::Trace::Propagation::TraceContext.text_extractor, - OpenTelemetry::CorrelationContext::Propagation.text_extractor + OpenTelemetry::Trace::Propagation::TraceContext.text_map_extractor, + OpenTelemetry::Baggage::Propagation.text_map_extractor ] end end end end