Sha256: 39cad1e70c93c0ae9f19ac4ccdf57d8c5e6e18c081efd7698ae051ef04241570

Contents?: true

Size: 942 Bytes

Versions: 5

Compression:

Stored size: 942 Bytes

Contents

# frozen_string_literal: true

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

module OpenTelemetry
  module SDK
    module Baggage
      # SDK implementation of Baggage::Builder
      class Builder
        attr_reader :entries

        def initialize(entries)
          @entries = entries
        end

        # Set key-value in the to-be-created baggage
        #
        # @param [String] key The key to store this value under
        # @param [String] value String value to be stored under key
        def set_value(key, value)
          @entries[key] = value.to_s
        end

        # Removes key from the to-be-created baggage
        #
        # @param [String] key The key to remove
        def remove_value(key)
          @entries.delete(key)
        end

        # Clears all baggage from the to-be-created baggage
        def clear
          @entries.clear
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
opentelemetry-sdk-0.10.0 lib/opentelemetry/sdk/baggage/builder.rb
opentelemetry-sdk-0.9.0 lib/opentelemetry/sdk/baggage/builder.rb
opentelemetry-sdk-0.8.0 lib/opentelemetry/sdk/baggage/builder.rb
opentelemetry-sdk-0.7.0 lib/opentelemetry/sdk/baggage/builder.rb
opentelemetry-sdk-0.6.0 lib/opentelemetry/sdk/baggage/builder.rb