lib/opentelemetry.rb in opentelemetry-api-0.5.1 vs lib/opentelemetry.rb in opentelemetry-api-0.6.0
- old
+ new
@@ -6,12 +6,11 @@
require 'logger'
require 'opentelemetry/error'
require 'opentelemetry/context'
-require 'opentelemetry/correlation_context'
-require 'opentelemetry/internal'
+require 'opentelemetry/baggage'
require_relative './opentelemetry/instrumentation'
require 'opentelemetry/metrics'
require 'opentelemetry/trace'
require 'opentelemetry/version'
@@ -21,13 +20,16 @@
#
# The OpenTelemetry module provides global accessors for telemetry objects.
module OpenTelemetry
extend self
- attr_writer :tracer_provider, :meter_provider, :correlations
+ attr_writer :tracer_provider, :meter_provider, :baggage, :logger
- attr_accessor :logger
+ # @return [Object, Logger] configured Logger or a default STDOUT Logger.
+ def logger
+ @logger ||= Logger.new(STDOUT, level: ENV['OTEL_LOG_LEVEL'] || Logger::INFO)
+ end
# @return [Object, Trace::TracerProvider] registered tracer provider or a
# default no-op implementation of the tracer provider.
def tracer_provider
@tracer_provider ||= Trace::TracerProvider.new
@@ -43,19 +45,17 @@
# instrumentation
def instrumentation_registry
@instrumentation_registry ||= Instrumentation::Registry.new
end
- # @return [Object, CorrelationContext::Manager] registered
- # correlation context manager or a default no-op implementation of the
+ # @return [Object, Baggage::Manager] registered
+ # baggage manager or a default no-op implementation of the
# manager.
- def correlations
- @correlations ||= CorrelationContext::Manager.new
+ def baggage
+ @baggage ||= Baggage::Manager.new
end
# @return [Context::Propagation::Propagation] an instance of the propagation API
def propagation
@propagation ||= Context::Propagation::Propagation.new
end
-
- self.logger = Logger.new(STDOUT)
end