class

Tracing::Reload

Inherits Tracing::Layer < Reference < Object

Wraps a Layer, allowing it to be replaced at runtime via a Handle.

Ported from upstream tracing_subscriber::reload. All Layer hooks delegate to the current inner layer (guarded by a mutex), so swapping the inner layer through the handle immediately changes behavior.

Divergence from upstream: upstream additionally rebuilds the global callsite interest cache on reload (callsite::rebuild_interest_cache). The Crystal port leaves global interest management to the dispatcher — Dispatch .with_default is fiber-local and does not register a global dispatcher, so Reload only swaps the inner layer. Upstream's weak-reference / lock- poisoning error surface (is_dropped, is_poisoned) has no Crystal equivalent and is omitted.

Constructors

new(inner : Layer) : Tuple(Reload, Handle)

Wraps inner, returning the reloadable layer and a Handle that can swap or mutate it at runtime. Mirrors upstream reload::Layer::new.

Source

Instance methods

enabled?(metadata : Metadata, ctx : LayerContext) : Bool

Returns true if this layer would enable the given metadata.

Source
handle

Returns an additional Handle that can reload this layer. Mirrors upstream reload::Layer::handle.

Source
max_level_hint

Returns the max level hint for this layer.

Source
on_close(id : Core::Span::Id, ctx : LayerContext) : Nil

Called immediately before a span is closed and removed from the registry.

Source
on_enter(id : Core::Span::Id, ctx : LayerContext) : Nil

Called when a span is entered.

Source
on_event(event : Core::Event, ctx : LayerContext) : Nil

Called when an event is recorded.

Source
on_exit(id : Core::Span::Id, ctx : LayerContext) : Nil

Called when a span is exited.

Source
on_new_span(attrs : Core::Span::Attributes, id : Core::Span::Id, ctx : LayerContext) : Nil

Called when a new span is created.

Source
on_record(id : Core::Span::Id, values : Core::Span::Record, ctx : LayerContext) : Nil

Called when fields are recorded on a span.

Source
on_record_follows_from(span : Core::Span::Id, follows : Core::Span::Id, ctx : LayerContext) : Nil

Called when a follows-from relationship is recorded.

Source
on_register_callsite(metadata : Metadata, ctx : LayerContext) : Callsite::Interest

Called when a callsite is registered.

Source