Module: PlainApm::Extensions::Context

Defined in:
lib/plain_apm/extensions/context.rb,
lib/plain_apm/extensions/context/rack.rb,
lib/plain_apm/extensions/context/railtie.rb,
lib/plain_apm/extensions/context/active_job.rb,
lib/plain_apm/extensions/context/middleware.rb

Defined Under Namespace

Modules: ActiveJob Classes: Rack, Railtie

Constant Summary collapse

STORE_KEY =
:plain_apm_extensions_store
TRACE_ID_KEY =
:trace_id
CONTEXT_KEY =
:context

Class Method Summary collapse

Class Method Details

.[](key) ⇒ Object



20
21
22
# File 'lib/plain_apm/extensions/context.rb', line 20

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

.[]=(key, value) ⇒ Object



24
25
26
# File 'lib/plain_apm/extensions/context.rb', line 24

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

.clear!Object



16
17
18
# File 'lib/plain_apm/extensions/context.rb', line 16

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

.contextObject



28
29
30
# File 'lib/plain_apm/extensions/context.rb', line 28

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

.context=(hash) ⇒ Object



32
33
34
# File 'lib/plain_apm/extensions/context.rb', line 32

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

.currentObject



12
13
14
# File 'lib/plain_apm/extensions/context.rb', line 12

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

.trace_idObject



36
37
38
# File 'lib/plain_apm/extensions/context.rb', line 36

def self.trace_id
  current[TRACE_ID_KEY]
end

.trace_id=(id) ⇒ Object



40
41
42
# File 'lib/plain_apm/extensions/context.rb', line 40

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