Sha256: e37e35ac924c6700bafc8e6591ee80afce5472cd07a16a79f91cf04f0cb780cd

Contents?: true

Size: 658 Bytes

Versions: 7

Compression:

Stored size: 658 Bytes

Contents

# frozen_string_literal: true

module Jaeger
  class ScopeManager
    # @api private
    class ScopeStack
      def initialize
        # Generate a random identifier to use as the Thread.current key. This is
        # needed so that it would be possible to create multiple tracers in one
        # thread (mostly useful for testing purposes)
        @scope_identifier = ScopeIdentifier.generate
      end

      def push(scope)
        store << scope
      end

      def pop
        store.pop
      end

      def peek
        store.last
      end

      private

      def store
        Thread.current[@scope_identifier] ||= []
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
dox-jaeger-client-2.0.0 lib/jaeger/scope_manager/scope_stack.rb
jaeger-client-with-ruby-32-support-2.0.0 lib/jaeger/scope_manager/scope_stack.rb
jaeger-client-1.3.0 lib/jaeger/scope_manager/scope_stack.rb
jaeger-client-1.2.0 lib/jaeger/scope_manager/scope_stack.rb
jaeger-client-1.1.0 lib/jaeger/scope_manager/scope_stack.rb
jaeger-client-1.0.0 lib/jaeger/scope_manager/scope_stack.rb
jaeger-client-0.10.0 lib/jaeger/scope_manager/scope_stack.rb