class
CQL::Telemetry::EventQueue(T)
- CQL::Telemetry::EventQueue(T)
- Reference
- Object
Overview
Runs the handler on its own fiber, so #push never waits. Call #close when finished, or that fiber lives forever.
Defined in:
telemetry/event_queue.crConstant Summary
-
MAX_PENDING_FLUSHES =
8 -
Flushes that may be pending at once, timed-out ones included until the consumer reaches them.
Constructors
Class Method Summary
-
.checked_capacity(capacity : Int32) : Int32
capacity itself when a queue can hold that many events; raises ArgumentError otherwise.
Instance Method Summary
-
#close : Nil
Stops accepting events, then drains the buffer without waiting: events are skipped, flushes return false.
- #dropped : Int64
-
#flush(timeout : Time::Span | Nil = nil) : Bool
True once every event pushed before it was handled; false on timeout, on close, on the consumer fiber or past
MAX_PENDING_FLUSHES. -
#push(event : T) : Bool
Enqueues event without waiting or allocating; false when closed or full (counted in
#dropped). -
#push(& : -> T) : Bool
Like
#push(event), but builds the event only once a slot is free, so a dropped event costs nothing.
Constructor Detail
Class Method Detail
capacity itself when a queue can hold that many events; raises ArgumentError otherwise.
Instance Method Detail
Stops accepting events, then drains the buffer without waiting: events are skipped, flushes return false.
True once every event pushed before it was handled; false on timeout, on close, on the consumer fiber
or past MAX_PENDING_FLUSHES. Without a timeout it waits on the handler, even one waiting for the
flusher: keep it off hot paths.
Enqueues event without waiting or allocating; false when closed or full (counted in #dropped).
Like #push(event), but builds the event only once a slot is free, so a dropped event costs nothing.
A block that raises, breaks or returns gives its slot back.