pig/obs/listener

Test listener for capturing telemetry events.

Attaches to :telemetry events and accumulates them into an ETS table. Returns typed List(Event) for assertion in tests. Designed for use in tests — no sleeping or polling needed.

Types

Handle to an attached listener. Do not construct directly.

pub type ListenerHandle

Values

pub fn attach() -> ListenerHandle

Attach a listener that captures all pig telemetry events.

pub fn attach_to(names: List(List(String))) -> ListenerHandle

Attach a listener for specific event names only.

pub fn detach(handle: ListenerHandle) -> Nil

Detach the listener and clean up resources.

pub fn event_count(handle: ListenerHandle) -> Int

Get the number of captured events.

pub fn get_event_names(
  handle: ListenerHandle,
) -> List(List(String))

Get all captured event names as raw strings, in emission order.

pub fn get_events(handle: ListenerHandle) -> List(events.Event)

Get all captured events as typed Event values, in emission order.

Search Document