Liking cljdoc? Tell your friends :D

dev.skivi.monitoring.core

Event emitter: fan-out delivery to registered handlers with a ring buffer.

Handlers registered with :all receive every event regardless of type. Handlers registered with a specific keyword receive only that event type. Handler errors are caught, counted in :dropped stats, and never propagate.

Thread safety: all mutable state lives in atoms updated with swap!/reset!. emit! and handler registration are safe to call concurrently.

Event emitter: fan-out delivery to registered handlers with a ring buffer.

Handlers registered with :all receive every event regardless of type.
Handlers registered with a specific keyword receive only that event type.
Handler errors are caught, counted in :dropped stats, and never propagate.

Thread safety: all mutable state lives in atoms updated with swap!/reset!.
emit! and handler registration are safe to call concurrently.
raw docstring

collecting-emitterclj

(collecting-emitter)

Returns an emitter that buffers every event without dropping. Useful in tests: call events to retrieve what was emitted.

Returns an emitter that buffers every event without dropping.
Useful in tests: call events to retrieve what was emitted.
sourceraw docstring

create-emitterclj

(create-emitter)
(create-emitter config)

Creates an event emitter from an events config map. config keys: :enabled (boolean), :buffer-size (pos-int).

Creates an event emitter from an events config map.
config keys: :enabled (boolean), :buffer-size (pos-int).
sourceraw docstring

emit!clj

(emit! emitter event-type data)

Emits an event of event-type with data map. Delivers to all :all handlers then all handlers registered for event-type. Exceptions thrown by handlers are caught and counted as :dropped. Returns nil.

Emits an event of event-type with data map. Delivers to all :all handlers
then all handlers registered for event-type. Exceptions thrown by handlers are
caught and counted as :dropped. Returns nil.
sourceraw docstring

enabled?clj

(enabled? emitter)

Returns true if the emitter will route events to handlers.

Returns true if the emitter will route events to handlers.
sourceraw docstring

eventsclj

(events emitter)

Returns a snapshot of buffered events in emission order (oldest first).

Returns a snapshot of buffered events in emission order (oldest first).
sourceraw docstring

noop-emitterclj

(noop-emitter)

Returns a disabled emitter. All emit! calls and handler registrations are no-ops. Use in tests or when monitoring is turned off in config.

Returns a disabled emitter. All emit! calls and handler registrations are
no-ops. Use in tests or when monitoring is turned off in config.
sourceraw docstring

offclj

(off emitter handler-id)

Removes the handler identified by handler-id from emitter. Returns nil.

Removes the handler identified by handler-id from emitter. Returns nil.
sourceraw docstring

onclj

(on emitter event-type handler-fn)

Registers handler-fn to receive events of event-type. Pass :all to receive every event regardless of type. Returns a handler-id (UUID) that can be passed to off to deregister. Returns nil when the emitter is disabled.

Registers handler-fn to receive events of event-type. Pass :all to receive
every event regardless of type. Returns a handler-id (UUID) that can be passed
to off to deregister. Returns nil when the emitter is disabled.
sourceraw docstring

statsclj

(stats emitter)

Returns a snapshot of emitter operational metrics. Keys: :emitted (total events emitted), :dropped (handler errors caught).

Returns a snapshot of emitter operational metrics.
Keys: :emitted (total events emitted), :dropped (handler errors caught).
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close