lib/opentelemetry/sdk/configurator.rb in opentelemetry-sdk-1.1.0 vs lib/opentelemetry/sdk/configurator.rb in opentelemetry-sdk-1.2.0

- old
+ new

@@ -139,15 +139,18 @@ OpenTelemetry.error_handler = error_handler configure_propagation configure_span_processors tracer_provider.id_generator = @id_generator OpenTelemetry.tracer_provider = tracer_provider + metrics_configuration_hook install_instrumentation end private + def metrics_configuration_hook; end + def tracer_provider @tracer_provider ||= Trace::TracerProvider.new(resource: @resource) end def check_use_mode!(mode) @@ -167,11 +170,11 @@ def configure_span_processors processors = @span_processors.empty? ? wrapped_exporters_from_env.compact : @span_processors processors.each { |p| tracer_provider.add_span_processor(p) } end - def wrapped_exporters_from_env # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize + def wrapped_exporters_from_env # rubocop:disable Metrics/CyclomaticComplexity exporters = ENV.fetch('OTEL_TRACES_EXPORTER', 'otlp') exporters.split(',').map do |exporter| case exporter.strip when 'none' then nil when 'otlp' @@ -201,9 +204,10 @@ when 'b3' then fetch_propagator(propagator, 'OpenTelemetry::Propagator::B3::Single') when 'b3multi' then fetch_propagator(propagator, 'OpenTelemetry::Propagator::B3::Multi', 'b3') when 'jaeger' then fetch_propagator(propagator, 'OpenTelemetry::Propagator::Jaeger') when 'xray' then fetch_propagator(propagator, 'OpenTelemetry::Propagator::XRay') when 'ottrace' then fetch_propagator(propagator, 'OpenTelemetry::Propagator::OTTrace') + when 'none' then NoopTextMapPropagator.new else OpenTelemetry.logger.warn "The #{propagator} propagator is unknown and cannot be configured" NoopTextMapPropagator.new end end