Skip to main content

Module runtime

Module runtime 

Source
Expand description

The Runtime type.

Runtimes combine components into a fully encapsulated diagnostic pipeline. Each runtime includes:

  • An Emitter to receive diagnostic events.
  • A Filter to limit the volume of diagnostic events.
  • A Ctxt to capture and attach ambient state to events.
  • A Clock to timestamp events.
  • A Rng to generate correlation ids for events.

Runtimes are fully isolated and may be short-lived. A Runtime can be treated generically, or erased behind an AmbientSlot for global sharing. This module defines two global runtimes; the shared() runtime, and the internal() runtime. Applications should emit their events through the shared() runtime. Code running within a runtime itself, such as an implementation of Emitter should emit their events through the internal() runtime.

The internal() runtime can only be initialized with components that also satisfy internal versions of their regular traits. These marker traits require a component not produce any diagnostics of its own, and so are safe to use by another runtime. If components in the internal() runtime could produce their own diagnostics then it could cause loops and stack overflows.

If an application is initializing both the shared() and internal() runtimes, then it should initialize the internal() runtime first.

Structs§

AmbientInternalSlot
A type-erased slot for the internal() runtime.
AmbientSlot
A type-erased slot for a globally shared Runtime.
AssertInternal
Assert that a given component does not emit any diagnostics of its own.
Runtime
A diagnostic pipeline.

Traits§

InternalClock
A marker trait for a Clock that does not emit any diagnostics of its own.
InternalCtxt
A marker trait for a Ctxt that does not emit any diagnostics of its own.
InternalEmitter
A marker trait for an Emitter that does not emit any diagnostics of its own.
InternalFilter
A marker trait for a Filter that does not emit any diagnostics of its own.
InternalRng
A marker trait for an Rng that does not emit any diagnostics of its own.

Functions§

internal
The internal runtime for other runtime components to use.
internal_slot
The initialization slot for the internal() runtime.
shared
The global shared runtime for applications to use.
shared_slot
The initialization slot for the shared() runtime.

Type Aliases§

AmbientClock
A type-erased Clock for an AmbientSlot.
AmbientCtxt
A type-erased Ctxt for an AmbientSlot.
AmbientEmitter
A type-erased Emitter for an AmbientSlot.
AmbientFilter
A type-erased Filter for an AmbientSlot.
AmbientRng
A type-erased Rng for an AmbientSlot.
AmbientRuntime
A type-erased Runtime.