# `MaeBPF.Plugs.SampleRingBuf`
[🔗](https://github.com/cocoa-xu/MaeBPF/blob/v0.1.0/maebpf/lib/maebpf/plugs/sample_ring_buf.ex#L1)

Emits a compact 16-byte packed event into a declared RingBuf `stream`:

    <<plug_id::16-little, action::16-little, ipv4_src::32-big,
      ipv4_dst::32-big, sport::16-big, dport::16-big>>

Whenever `bpf_ringbuf_reserve` returns `NULL`, the compiler automatically
increments the hidden `"__maebpf_rb_drops_<stream>"` `PERCPU_ARRAY` counter
so RingBuf drops are never silent.

Options:
  * `:stream` / `:map` - target RingBuf stream atom (required)
  * `:action` - action tag recorded in event (default `:cont`)
  * `:every` - emit 1 out of every `N` packets (`>= 1`, default `1`)
  * `:ringbuf_kb` - optional RingBuf size in KiB when auto-declaring maps

---

*Consult [api-reference.md](api-reference.md) for complete listing*
