Sha256: 420ccd606d9a33d680354339200054fbe8228dadd3ff671453d3b33857f6848e

Contents?: true

Size: 739 Bytes

Versions: 33

Compression:

Stored size: 739 Bytes

Contents

module PlainApm
  module Extensions
    module Context
      STORE_KEY = :plain_apm_extensions_store
      TRACE_ID_KEY = :trace_id
      CONTEXT_KEY = :context

      def self.current
        Thread.current[STORE_KEY] ||= {}
      end

      def self.clear!
        Thread.current[STORE_KEY] = {}
      end

      def self.[](key)
        current[key]
      end

      def self.[]=(key, value)
        current[key] = value
      end

      def self.context
        current[CONTEXT_KEY] ||= {}
      end

      def self.context=(hash)
        current[CONTEXT_KEY] = hash
      end

      def self.trace_id
        current[TRACE_ID_KEY]
      end

      def self.trace_id=(id)
        current[TRACE_ID_KEY] = id
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
plain_apm-0.6.1 lib/plain_apm/extensions/context.rb
plain_apm-0.5.7 lib/plain_apm/extensions/context.rb
plain_apm-0.5.6 lib/plain_apm/extensions/context.rb
plain_apm-0.5.5 lib/plain_apm/extensions/context.rb
plain_apm-0.5.4 lib/plain_apm/extensions/context.rb
plain_apm-0.5.3 lib/plain_apm/extensions/context.rb
plain_apm-0.5.2 lib/plain_apm/extensions/context.rb
plain_apm-0.5.1 lib/plain_apm/extensions/context.rb
plain_apm-0.5.0 lib/plain_apm/extensions/context.rb
plain_apm-0.4.0 lib/plain_apm/extensions/context.rb
plain_apm-0.3.0 lib/plain_apm/extensions/context.rb
plain_apm-0.2.9 lib/plain_apm/extensions/context.rb
plain_apm-0.2.8 lib/plain_apm/extensions/context.rb