struct OpenTelemetry::API::Context
- OpenTelemetry::API::Context
- OpenTelemetry::API::AbstractContext
- Struct
- Value
- Object
Defined in:
api/context.crapi/context/key.cr
Constructors
Class Method Summary
- .[](key)
- .[]=(key, value)
- .[]?(key)
- .attach(entries)
- .clear
- .create_key(name)
- .create_key
- .current
-
.detach(token)
Restores the previous Context associated with the current Fiber.
- .set_value(key, value)
- .stack
- .value(key)
- .value?(key)
-
.with(key, values)
Execute a block in a new context with key set to value.
-
.with(values)
@param [String] key The lookup key @param [Hash] values Will be merged with values of the current context and returned in a new context @param [Callable] Block to execute in a new context @yield [context, values] Yields the newly created context and values to the block
Instance Method Summary
- #[](key)
- #[]=(key, value)
- #[]?(key)
- #entries
- #merge(other_entries)
-
#object_id : CSUUID
This is assumed to be implemented as a getter with a default value of
CSUUID.unique
. - #set_value(key, value)
- #value(key)
- #value?(key)
Instance methods inherited from struct OpenTelemetry::API::AbstractContext
[](key)
[],
[]=(key, value)
[]=,
[]?(key)
[]?,
entries
entries,
merge(other_entries)
merge,
object_id
object_id,
set_value(key, value)
set_value,
value(key)
value,
value?(key)
value?
Constructor methods inherited from struct OpenTelemetry::API::AbstractContext
new(entries : ContextContainer)new(entries)
new new
Class methods inherited from struct OpenTelemetry::API::AbstractContext
[](key)
[],
[]=(key, value)
[]=,
[]?(key)
[]?,
attach(context : Context)attach(entries) attach, clear clear, create_key(name)
create_key create_key, current current, detach(token) detach, set_value(key, value) set_value, stack stack, value(key) value, value?(key) value?, with(key, values)
with(context : Context)
with(values) with
Constructor Detail
Class Method Detail
Restores the previous Context associated with the current Fiber. The supplied token is used to check if the call to detach is balanced with a corresponding attach call. A warning is logged if the calls are unbalanced.
Execute a block in a new context with key set to value. Restores the previous context after the block executes.
@param [String] key The lookup key @param [Hash] values Will be merged with values of the current context and returned in a new context @param [Callable] Block to execute in a new context @yield [context, values] Yields the newly created context and values to the block
Instance Method Detail
This is assumed to be implemented as a getter with
a default value of CSUUID.unique
.