Sha256: c27886d909e7aa24eaa90bccae0c3ea2b4c3556c765bf5cdaa756a67a154eaba

Contents?: true

Size: 1.6 KB

Versions: 5

Compression:

Stored size: 1.6 KB

Contents

# frozen_string_literal: true

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

require 'opentelemetry/baggage/propagation/context_keys'
require 'opentelemetry/baggage/propagation/text_map_injector'
require 'opentelemetry/baggage/propagation/text_map_extractor'

module OpenTelemetry
  module Baggage
    # The Baggage::Propagation module contains injectors and
    # extractors for sending and receiving baggage over the wire
    module Propagation
      extend self

      TEXT_MAP_EXTRACTOR = TextMapExtractor.new
      TEXT_MAP_INJECTOR = TextMapInjector.new
      RACK_EXTRACTOR = TextMapExtractor.new(
        baggage_key: 'HTTP_BAGGAGE'
      )
      RACK_INJECTOR = TextMapInjector.new(
        baggage_key: 'HTTP_BAGGAGE'
      )

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

      # Returns an extractor that extracts context using the W3C Baggage
      # format
      def text_map_injector
        TEXT_MAP_INJECTOR
      end

      # Returns an injector that injects context using the W3C Baggage
      # format
      def text_map_extractor
        TEXT_MAP_EXTRACTOR
      end

      # Returns an extractor that extracts context using the W3C Baggage
      # format with Rack normalized keys (upcased and prefixed with
      # HTTP_)
      def rack_injector
        RACK_INJECTOR
      end

      # Returns an injector that injects context using the W3C Baggage
      # format with Rack normalized keys (upcased and prefixed with
      # HTTP_)
      def rack_extractor
        RACK_EXTRACTOR
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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