Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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
FeatureDefaultAdds
cli, tuiyesthe subcommands and the terminal UI
staticyesAeron 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
archiveyesthe archive control reader (Archive tabs); the one part that needs a JDK
httpno--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.

TabSubcommandAeron 1.54.3 toolShows
CounterscountersAeronStatevery counter: value, change per second, change since the mark
StreamsstreamsStreamStat, BacklogStatone row per stream: every position, backlog, the slowest subscriber and the publisher’s headroom
ErrorserrorsErrorStatdistinct errors with their count, first and last time
LosslossLossStatper stream: gaps and bytes lost
DriverdriverDriverTool (pid, CnC metadata)pid, versions, buffer lengths, heartbeat age
Messagesmessagesnone (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
Recordingsrecordingsnone (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
Payloadreplaynone (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 dirarchive-dirArchiveTool (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:

ActionVimPlain
move upkUp
move downjDown
half a page upCtrl-uPageUp
half a page downCtrl-dPageDown
first rowggHome
last rowGEnd
next tabgtTab
previous tabgTShift-Tab
open the selected row’s detail (Messages: the message’s preview)lEnter Right
show the selected stream’s (or recording’s) messageswF4
Messages tab: hide or show what the values mean (shown at start)ii
Counters: mark the next link in the detail (owner, stream, …)rF8
Counters: jump to the marked link, on the tab and row it namesfF9
Counters: scroll the open detail down]F10
Counters: scroll the open detail up[F11
close the detail, the filter or help; quit at the topqEsc
close the detail, the filter or help; never quitshLeft
filter the list; search the preview (regex); capitals: exact case/Ctrl-f
next matching row (in a preview: next match)nF3
previous matching row (in a preview: previous match)NShift-F3
pause or resume the live viewSpaceSpace
mark: count counters from now (C2)mF5
sort by the next column (again: reverse, then off)sF6
open a stream, channel or schema used before (history)oF7
connect to the archive seen in the counters (again: other channel)cF12
–write: this tab’s write actionsaF2
Messages: the open preview full screen, lines wrapped (again: back)zz
Messages: copy the open preview to the clipboard (OSC 52)yy
mouse capture off, so the terminal selects text (again: on)MM
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).