Module: OpenTelemetry::Context

Extended by:
Context
Included in:
Context
Defined in:
lib/opentelemetry/context.rb

Overview

The Context module provides per-thread storage.

Instance Method Summary collapse

Instance Method Details

#get(key) ⇒ Object



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

def get(key)
  storage[key]
end

#with(key, value) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/opentelemetry/context.rb', line 16

def with(key, value)
  store = storage
  previous = store[key]
  store[key] = value
  yield value
ensure
  store[key] = previous
end