Sha256: f8db17efde6a5eba4ed647573ea08b7520be71c2d1785f1684429946ecc61d0d

Contents?: true

Size: 1.87 KB

Versions: 5

Compression:

Stored size: 1.87 KB

Contents

# frozen_string_literal: true

# Copyright 2020 OpenTelemetry Authors
#
# SPDX-License-Identifier: Apache-2.0

require 'logger'

require 'opentelemetry/error'
require 'opentelemetry/context'
require 'opentelemetry/baggage'
require_relative './opentelemetry/instrumentation'
require 'opentelemetry/metrics'
require 'opentelemetry/trace'
require 'opentelemetry/version'

# OpenTelemetry is an open source observability framework, providing a
# general-purpose API, SDK, and related tools required for the instrumentation
# of cloud-native software, frameworks, and libraries.
#
# The OpenTelemetry module provides global accessors for telemetry objects.
module OpenTelemetry
  extend self

  attr_writer :tracer_provider, :meter_provider, :baggage, :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
  end

  # @return [Object, Metrics::MeterProvider] registered meter provider or a
  #   default no-op implementation of the meter provider.
  def meter_provider
    @meter_provider ||= Metrics::MeterProvider.new
  end

  # @return [Instrumentation::Registry] registry containing all known
  #  instrumentation
  def instrumentation_registry
    @instrumentation_registry ||= Instrumentation::Registry.new
  end

  # @return [Object, Baggage::Manager] registered
  #   baggage manager or a default no-op implementation of the
  #   manager.
  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
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
opentelemetry-api-0.10.0 lib/opentelemetry.rb
opentelemetry-api-0.9.0 lib/opentelemetry.rb
opentelemetry-api-0.8.0 lib/opentelemetry.rb
opentelemetry-api-0.7.0 lib/opentelemetry.rb
opentelemetry-api-0.6.0 lib/opentelemetry.rb