Sha256: f2d21446eeff2acaca8de1191c697a6be687b3099c488c13eadbb5ecff868bea

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

# frozen_string_literal: true

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

module OpenTelemetry
  module Trace
    # No-op implementation of a tracer factory.
    class TracerFactory
      HTTP_TEXT_FORMAT = DistributedContext::Propagation::TextFormat.new(
        traceparent_header_key: 'traceparent',
        tracestate_header_key: 'tracestate'
      )
      RACK_HTTP_TEXT_FORMAT = DistributedContext::Propagation::TextFormat.new(
        traceparent_header_key: 'HTTP_TRACEPARENT',
        tracestate_header_key: 'HTTP_TRACESTATE'
      )
      BINARY_FORMAT = DistributedContext::Propagation::BinaryFormat.new
      private_constant(:HTTP_TEXT_FORMAT, :RACK_HTTP_TEXT_FORMAT, :BINARY_FORMAT)

      # Returns a {Tracer} instance.
      #
      # @param [optional String] name Instrumentation package name
      # @param [optional String] version Instrumentation package version
      #
      # @return [Tracer]
      def tracer(name = nil, version = nil)
        @tracer ||= Tracer.new
      end

      def binary_format
        BINARY_FORMAT
      end

      def http_text_format
        HTTP_TEXT_FORMAT
      end

      def rack_http_text_format
        RACK_HTTP_TEXT_FORMAT
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opentelemetry-api-0.2.0 lib/opentelemetry/trace/tracer_factory.rb