ergo-aeron
ergo-aeron shows what an Aeron media driver is doing: every counter with its
rate, one row per stream with every position and which subscriber holds the
publisher back, the error log, the loss report, the driver’s own metadata,
and one stream’s messages decoded with your SBE schemas. It reads the
driver’s cnc.dat and loss-report.dat and, for messages, the stream’s log
file. For these tabs it starts no
Aeron client and adds no subscription, so the driver and its publishers
cannot tell it is there (the archive tabs’ --control session is a client:
Archive tabs). That is attached mode, the default; with
--embedded it runs a driver of its own and can join a stream named by its
channel as a guarded receiver instead (Attached or embedded).
Install
It is the crate ergo-aeron-tools. Aeron’s C is built from source: the build
needs CMake, a C compiler and libclang (on Linux also the uuid and libbsd
development packages), and, for the archive client’s codecs, a JDK 17 or newer
with network access the first time (Aeron’s Gradle).
cargo install ergo-aeron-tools
# No JDK: no `recordings`, `recording`, `replay` or `--control`.
cargo install ergo-aeron-tools --no-default-features --features cli,tui,static
# From a checkout of the repository:
cargo install --path aeron-tools
Without archive (--no-default-features --features cli,tui,static),
recordings, recording, replay and --control are not there
(Archive tabs).
Then, where the driver’s directory is visible:
ergo-aeron --aeron-dir /dev/shm/aeron
| Feature | Default | Adds |
|---|---|---|
cli, tui | yes | the subcommands and the terminal UI |
static | yes | Aeron linked into the binary, so it runs from wherever it is copied. Without it the program needs libaeron on the loader path, so keep it for an installed binary |
archive | yes | the archive control reader (Archive tabs); the one part that needs a JDK |
http | no | --schema https://... |
With no subcommand on a terminal it opens the screen below. With a
subcommand it prints and exits, so every tab also works in a pipe
(In scripts and pipes). --aeron-dir defaults to AERON_DIR, then
to Aeron’s own default directory.
In a checkout of the repository, just run-sample starts a driver with live
SBE publishers and consumers and opens ergo-aeron on them (CMake and a C
compiler); just run-sample archive adds a Java Aeron Archive recording the
streams (also JDK 17 or newer). Streams and keys:
samples/README.md.
For a driver in a cluster, see In Kubernetes.
To see a driver with trouble in it, start the example driver: one IPC stream (1001) whose only subscriber never polls, so its publisher sits at its limit, one (1002) carrying a car-schema message every 20 ms, and one refused endpoint in the error log. Ctrl-C stops it and removes its directory.
cargo run -p ergo-aeron-tools --example fixture_driver -- target/fixture-aeron
cargo run -p ergo-aeron-tools --bin ergo-aeron -- --aeron-dir target/fixture-aeron \
--schema sbe/tests/fixtures/schemas/car.xml
The Messages tab is Live messages. With --control URI or
--archive-dir DIR the screen gains an Aeron Archive’s tabs, Recordings,
Payload and Archive dir (Archive tabs); --archive-dir alone
opens with no driver, and an archive seen in the driver’s counters adds the
Recordings tab by itself.
The screen
ergo-aeron [READ ONLY] dir=/dev/shm/aeron-test driver pid 4121 heartbeat 3 ms
ALARM Sender flow control limits, i.e. back-pressure events: rose by 3 to 3
Counters Streams Errors Loss Driver Messages
? help / filter Space pause m mark s sort q quit
stream session pub pos pub limit snd pos snd limit rcv hwm rcv pos subscribers (id@pos) slowest behind headroom % channel
1001 77 97920 98304 - - - - 7@65536 9@97920 7 32384 1.2 aeron:ipc?term-length=65536
2002 5 1048576 1179648 1046528 1179648 - - 13@1040384 13 8192 94.1 aeron:udp?endpoint=10.0.0.1:40123
The top line says the tool is read-only, or [WRITE] when started with
--write (the one write action) (and, in
embedded mode, [LIVE RECEIVER]), then the directory, the driver’s
pid and the age of its heartbeat. The second line is the health verdict
(OK, WARN or ALARM) with its first reason; Driver tabs and Aeron’s own
tools lists what it watches. Then the tabs, then the
filter line, then the list.
| Tab | Subcommand | Aeron 1.54.3 tool | Shows |
|---|---|---|---|
| Counters | counters | AeronStat | every counter: value, change per second, change since the mark |
| Streams | streams | StreamStat, BacklogStat | one row per stream: every position, backlog, the slowest subscriber and the publisher’s headroom |
| Errors | errors | ErrorStat | distinct errors with their count, first and last time |
| Loss | loss | LossStat | per stream: gaps and bytes lost |
| Driver | driver | DriverTool (pid, CnC metadata) | pid, versions, buffer lengths, heartbeat age |
| Messages | messages | none (LogInspector reads the same log file, offline) | one stream’s messages, read from its log file with no subscription, decoded with the schemas given; counts per message type |
| Recordings | recordings | none (the archive client’s listRecordings and position queries) | an archive’s recordings from its control session, read requests only: positions, start and stop, stream, channel, session; each active recording’s lag |
| Payload | replay | none (the archive client’s startReplay) | one recording’s messages, replayed through the control session and decoded with the schemas given; live while it records |
| Archive dir | archive-dir | ArchiveTool (describe, describe-all, count-entries, capacity, pid, errors, dump, verify without marking) | an archive directory read as files, never written: catalogue, mark file, segment files, disk use and time until full |
Keys and mouse
Every action has a vim key and a plain key:
| Action | Vim | Plain |
|---|---|---|
| move up | k | Up |
| move down | j | Down |
| half a page up | Ctrl-u | PageUp |
| half a page down | Ctrl-d | PageDown |
| first row | gg | Home |
| last row | G | End |
| next tab | gt | Tab |
| previous tab | gT | Shift-Tab |
| open the selected row’s detail (Messages: the message’s preview) | l | Enter Right |
| show the selected stream’s (or recording’s) messages | w | F4 |
| Messages tab: hide or show what the values mean (shown at start) | i | i |
| Counters: mark the next link in the detail (owner, stream, …) | r | F8 |
| Counters: jump to the marked link, on the tab and row it names | f | F9 |
| Counters: scroll the open detail down | ] | F10 |
| Counters: scroll the open detail up | [ | F11 |
| close the detail, the filter or help; quit at the top | q | Esc |
| close the detail, the filter or help; never quits | h | Left |
| filter the list; search the preview (regex); capitals: exact case | / | Ctrl-f |
| next matching row (in a preview: next match) | n | F3 |
| previous matching row (in a preview: previous match) | N | Shift-F3 |
| pause or resume the live view | Space | Space |
| mark: count counters from now (C2) | m | F5 |
| sort by the next column (again: reverse, then off) | s | F6 |
| open a stream, channel or schema used before (history) | o | F7 |
| connect to the archive seen in the counters (again: other channel) | c | F12 |
| –write: this tab’s write actions | a | F2 |
| Messages: the open preview full screen, lines wrapped (again: back) | z | z |
| Messages: copy the open preview to the clipboard (OSC 52) | y | y |
| mouse capture off, so the terminal selects text (again: on) | M | M |
| help | ? | F1 |
/ opens the filter: a regular expression over the whole row (bytes rec
or bytes.*received finds Bytes received); a query with no capital
ignores case. A pattern that is not one yet, half typed, is matched as
written, and the filter line says so. The list keeps its order, and the
matched text is highlighted. Enter keeps the filter, Esc drops it.
The mouse does the same: click a tab, a row or a column header (again to
reverse, a third time to unsort), and the wheel scrolls. M turns mouse
capture off so the terminal can select text (Copy and
select). The selection stays
on the same counter or stream while the values change and the rows move.
Space pauses the tables; the health line stays live. m marks: the since mark column counts from that moment, and the health line forgets warnings
older than the mark, which is how to watch a test run from a clean start.
Enter opens the selected row’s detail; on the Streams tab it starts with
the main fields of the stream’s log (log inspector). On the Counters tab a sparkline
under the list shows the selected counter’s change per read. On the Streams
tab w shows the selected stream’s messages (on the Recordings tab it replays
the selected recording), and o (or F7) opens the
history of streams, channels and schemas used before (history).