ContextStorage

zio.blocks.telemetry.ContextStorage
See theContextStorage companion object
sealed trait ContextStorage[A]

Scoped context storage for propagating values through call stacks.

Only two operations:

  • get(): read the current value
  • scoped(): run a block with a different value, automatically restored after

No set() — context is immutable outside scoped blocks. This aligns with JDK 25's ScopedValue semantics and prevents context leaks.

Attributes

See also

docs/adr/0001-scoped-context-no-set.md

Companion
object
Source
ContextStorage.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def get(): A

Attributes

Source
ContextStorage.scala
def scoped[B](value: A)(f: => B): B

Attributes

Source
ContextStorage.scala