Sha256: c7c01a9a6aa84a3b2e69e3d88f4975ad29893ca4435f3b38d2c4961b40a0de6e

Contents?: true

Size: 1.98 KB

Versions: 3

Compression:

Stored size: 1.98 KB

Contents

# frozen_string_literal: true

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

require_relative './single/text_map_extractor'
require_relative './single/text_map_injector'

# 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.
# See the documentation for the `opentelemetry-api` gem for details.
module OpenTelemetry
  # Namespace for OpenTelemetry propagator extension libraries
  module Propagator
    # Namespace for OpenTelemetry B3 propagation
    module B3
      # Namespace for OpenTelemetry b3 single header encoding
      module Single
        extend self

        TEXT_MAP_EXTRACTOR = TextMapExtractor.new
        TEXT_MAP_INJECTOR = TextMapInjector.new
        RACK_EXTRACTOR = TextMapExtractor.new(
          b3_key: 'HTTP_B3'
        )
        RACK_INJECTOR = TextMapInjector.new(
          b3_key: 'HTTP_B3'
        )

        private_constant :TEXT_MAP_INJECTOR, :TEXT_MAP_EXTRACTOR, :RACK_INJECTOR,
                         :RACK_EXTRACTOR

        # Returns an extractor that extracts context in the B3 single header
        # format
        def text_map_injector
          TEXT_MAP_INJECTOR
        end

        # Returns an injector that injects context in the B3 single header
        # format
        def text_map_extractor
          TEXT_MAP_EXTRACTOR
        end

        # Returns an extractor that extracts context in the B3 single header
        # format with Rack normalized keys (upcased and prefixed with
        # HTTP_)
        def rack_injector
          RACK_INJECTOR
        end

        # Returns an injector that injects context in the B3 single header
        # format with Rack normalized keys (upcased and prefixed with
        # HTTP_)
        def rack_extractor
          RACK_EXTRACTOR
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
opentelemetry-propagator-b3-0.13.0 lib/opentelemetry/propagator/b3/single.rb
opentelemetry-propagator-b3-0.12.0 lib/opentelemetry/propagator/b3/single.rb
opentelemetry-propagator-b3-0.11.0 lib/opentelemetry/propagator/b3/single.rb