Sha256: bdf22d0d38c6e3b7ee3b7baf3e451be514ffc4338d132341fc64c2ac4dcb51b8

Contents?: true

Size: 919 Bytes

Versions: 2

Compression:

Stored size: 919 Bytes

Contents

# frozen_string_literal: true

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

module OpenTelemetry
  module Baggage
    # No op implementation of Baggage::Manager
    class NoopManager
      NOOP_BUILDER = NoopBuilder.new
      EMPTY_HASH = {}.freeze
      private_constant(:NOOP_BUILDER, :EMPTY_HASH)

      def build(context: Context.current)
        yield NOOP_BUILDER
        context
      end

      def set_value(key, value, metadata: nil, context: Context.current)
        context
      end

      def value(key, context: Context.current)
        nil
      end

      def values(context: Context.current)
        EMPTY_HASH
      end

      def raw_entries(context: Context.current)
        EMPTY_HASH
      end

      def remove_value(key, context: Context.current)
        context
      end

      def clear(context: Context.current)
        context
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
opentelemetry-api-1.0.0.rc1 lib/opentelemetry/baggage/noop_manager.rb
opentelemetry-api-0.17.0 lib/opentelemetry/baggage/noop_manager.rb