27 releases

new 0.11.5 Jan 12, 2025
0.11.4 Jan 10, 2025
0.11.0-alpha.21 Oct 21, 2024
0.11.0-alpha.17 Sep 20, 2024
0.11.0-alpha.6 Jun 28, 2024

#301 in Debugging

Download history 67/week @ 2024-09-22 158/week @ 2024-09-29 37/week @ 2024-10-06 290/week @ 2024-10-13 372/week @ 2024-10-20 18/week @ 2024-10-27 32/week @ 2024-11-03 2/week @ 2024-11-10 4/week @ 2024-11-17 7/week @ 2024-11-24 2/week @ 2024-12-01 51/week @ 2024-12-08 4/week @ 2024-12-15 633/week @ 2025-01-05

638 downloads per month
Used in 2 crates

MIT/Apache

2.5MB
7.5K SLoC

Rust 5.5K SLoC // 0.2% comments JavaScript 2K SLoC // 0.0% comments

emit_batcher

batcher

Current docs

Infrastructure for emitting diagnostic events in the background.


lib.rs:

Infrastructure for emitting diagnostic events in the background.

This library implements a channel that can be used to spawn background workers on a dedicated thread or tokio runtime. The channel implements:

  • Batching: Events written to the channel are processed by the worker in batches rather than one-at-a-time.
  • Retries with backoff: If the worker fails or panics then the batch can be retried up to some number of times, with backoff applied between retries. The worker can decide how much of a batch needs to be retried.
  • Maximum size management: If the worker can't keep up then the channel truncates to avoid runaway memory use. The alternative would be to apply backpressure, but that would affect system availability so isn't suitable for diagnostics.
  • Flushing: Callers can ask the worker to signal when all diagnostic events in the channel at the point they called are processed. This can be used for auditing and flushing on shutdown.

Dependencies

~0.7–6.5MB
~46K SLoC