require_relative "context/rack" require_relative "context/active_job" require_relative "context/railtie" if defined?(Rails::Railtie) 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