Sha256: fcd0949be50da426c58a2795af7cfa1538027827ff215f8e6a60ab2b5503fb04

Contents?: true

Size: 625 Bytes

Versions: 6

Compression:

Stored size: 625 Bytes

Contents

# frozen_string_literal: true

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

module OpenTelemetry
  module Common
    module Propagation
      # The SymbolKeyGetter class provides a common method for reading
      # symbol keys from a hash.
      class SymbolKeyGetter
        # Converts key into a symbol and reads it from the carrier.
        # Useful for extract operations.
        def get(carrier, key)
          carrier[key.to_sym]
        end

        # Reads all keys from a carrier
        def keys(carrier)
          carrier.keys.map(&:to_s)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
opentelemetry-common-0.20.1 lib/opentelemetry/common/propagation/symbol_key_getter.rb
opentelemetry-common-0.20.0 lib/opentelemetry/common/propagation/symbol_key_getter.rb
opentelemetry-common-0.19.7 lib/opentelemetry/common/propagation/symbol_key_getter.rb
opentelemetry-common-0.19.6 lib/opentelemetry/common/propagation/symbol_key_getter.rb
opentelemetry-common-0.19.5 lib/opentelemetry/common/propagation/symbol_key_getter.rb
opentelemetry-common-0.19.3 lib/opentelemetry/common/propagation/symbol_key_getter.rb