Repository navigation
Conversation
|
@coderabbitai full review |
✅ Action performedFull review finished. |
a8677c5 to
123d4a8
Compare
eaf0749 to
410233c
Compare
123d4a8 to
0eb74db
Compare
|
@rain-marvin review |
|
🔎 Reviewing |
There was a problem hiding this comment.
This PR makes the bot count its own error and warning log lines as it writes them. A tracing layer sits behind the file log's filter and feeds one-minute buckets per level and target. The bot then publishes liq_reliability_log_count_24h, liq_log_target_count_24h and log_events_total itself, so the exporter no longer rescans up to 50,000 log entries every minute. After each start, a one-time background seed adds the previous process's last 24 h from the files, and it takes only entries strictly before activation. The /logs scanner is split into visitor helpers that the seed shares, which also fixes an endless loop on a persistent read error.
Overall this is sound. The activation boundary prevents double counting. The seed state machine is bounded (two retries, then it keeps a partial read) and runs off the collectors' path. Nothing logs while a lock is held. The /logs and /performance/reliability behaviour is preserved apart from the documented fix. A concern that the bucket mutex could stall logging threads during window() or merge() was checked independently and dismissed: the maps are bounded at about 1,440 minutes per target, and the lock is held for microseconds to low milliseconds. I found no upgrade or shared-stall risk. What remains is two minor points (log counts freeze while the SQLite loaders fail, and no positive test that the production setup attaches the counting layer) and two documentation nits.
claude-opus-5-5 · high · 1 h 2 min
|
@coderabbitai approve |
✅ Action performedComments resolved and changes approved. |
410233c to
2d275dc
Compare
0eb74db to
045776e
Compare

Part of RAI-3091.
Counts error and warning logs as the bot writes them, for
liq_reliability_log_count_24handliq_log_target_count_24h. Item 3 of the RAI-2998 stack, part 3 of 3.Live effect: the reliability family gains the two log-count names, and
/metricsgainslog_events_total{level,target}. After each start a background task reads the last 24 h of log files once · Risk: low to medium (a new layer runs on every file log event, and the/logsscanner was refactored) · Ships: on the next bot releaseWhy
The exporter got these counts by rescanning up to 50,000 log entries through
/performance/reliabilityevery minute. Counting as events happen is cheaper and has no cap.Decisions
st0x_configgets aLogEventSinktrait. The counting layer is attached only on the file-logging branch, with the file layer's own filter. So it counts what the file log writes, and no dependency TRACE callsite is enabled for it.compare.pywith evidence: no 50k cap (decision J11), the first minute of the window counts whole, lines an operator'sst0x-clirun appends to the same files are counted only after the next restart, and a line the lossy non-blocking writer drops is still counted.liq_reliability_log_count_24hcompares keys only, andliq_log_target_count_24his ignored. A target can exist on one side only./logsfile scanner is split into visitor helpers that the seed shares./logsand/performance/reliabilitybehave the same, except one bug fix. A persistent read error, for example a directory namedst0x-hedge.log.*, used to loop forever on that file. Now it stops reading that file.Proof
golden.py --check,test_compare.py, andgen-t0-liquidity.py --checkpass. The reliability golden now includes the log names.log_events_total.st0x-hedgeandst0x-configsuites on this head: 5283 passed. One failure wasapi::tests::a_fee_bumped_copy_of_the_burn_is_adopted_as_its_replacement(anvil "max fee per gas less than block base fee"). It's unrelated and passed 3 of 3 times on rerun./performance/reliability, and the seed time on production-size log files. Those need a release.Merge conditions
Same as the stack below.