Sha256: 52ba016ff3d5654bb73d4a6729158bb7173a2194ff94002b3df6f0118a68a3c4

Contents?: true

Size: 1.2 KB

Versions: 15

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true

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

module OpenTelemetry
  module Baggage
    # Operational implementation of Baggage::Builder
    class Builder
      # @api private
      attr_reader :entries

      # @api private
      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
      # @param [optional String] metadata This is here to store properties
      #   received from other W3C Baggage impelmentations but is not exposed in
      #   OpenTelemetry. This is condsidered private API and not for use by
      #   end-users.
      def set_value(key, value, metadata: nil)
        @entries[key] = OpenTelemetry::Baggage::Entry.new(value, metadata)
      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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
opentelemetry-api-1.3.0 lib/opentelemetry/baggage/builder.rb
opentelemetry-api-1.2.5 lib/opentelemetry/baggage/builder.rb
opentelemetry-api-1.2.4 lib/opentelemetry/baggage/builder.rb
opentelemetry-api-1.2.3 lib/opentelemetry/baggage/builder.rb
opentelemetry-api-1.2.2 lib/opentelemetry/baggage/builder.rb
opentelemetry-api-1.2.1 lib/opentelemetry/baggage/builder.rb
opentelemetry-api-1.2.0 lib/opentelemetry/baggage/builder.rb
opentelemetry-api-1.1.0 lib/opentelemetry/baggage/builder.rb
opentelemetry-api-1.0.2 lib/opentelemetry/baggage/builder.rb
opentelemetry-api-1.0.1 lib/opentelemetry/baggage/builder.rb
opentelemetry-api-1.0.0 lib/opentelemetry/baggage/builder.rb
opentelemetry-api-1.0.0.rc3 lib/opentelemetry/baggage/builder.rb
opentelemetry-api-1.0.0.rc2 lib/opentelemetry/baggage/builder.rb
opentelemetry-api-1.0.0.rc1 lib/opentelemetry/baggage/builder.rb
opentelemetry-api-0.17.0 lib/opentelemetry/baggage/builder.rb