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.9.2 lib/plain_apm/extensions/context.rb
plain_apm-0.9.1 lib/plain_apm/extensions/context.rb
plain_apm-0.9.0 lib/plain_apm/extensions/context.rb
plain_apm-0.8.8 lib/plain_apm/extensions/context.rb
plain_apm-0.8.7 lib/plain_apm/extensions/context.rb
plain_apm-0.8.6 lib/plain_apm/extensions/context.rb
plain_apm-0.8.5 lib/plain_apm/extensions/context.rb
plain_apm-0.8.4 lib/plain_apm/extensions/context.rb
plain_apm-0.8.3 lib/plain_apm/extensions/context.rb
plain_apm-0.8.2 lib/plain_apm/extensions/context.rb
plain_apm-0.8.1 lib/plain_apm/extensions/context.rb
plain_apm-0.8.0 lib/plain_apm/extensions/context.rb
plain_apm-0.7.1 lib/plain_apm/extensions/context.rb
plain_apm-0.7.0 lib/plain_apm/extensions/context.rb
plain_apm-0.6.7 lib/plain_apm/extensions/context.rb
plain_apm-0.6.6 lib/plain_apm/extensions/context.rb
plain_apm-0.6.5 lib/plain_apm/extensions/context.rb
plain_apm-0.6.4 lib/plain_apm/extensions/context.rb
plain_apm-0.6.3 lib/plain_apm/extensions/context.rb
plain_apm-0.6.2 lib/plain_apm/extensions/context.rb