From dcf0ff29536223eb1be2ba447ffc67d7a64ed846 Mon Sep 17 00:00:00 2001 From: Flotapponnier <160007691+Flotapponnier@users.noreply.github.com> Date: Mon, 5 Oct 2026 11:34:36 +0200 Subject: [PATCH] head_lag_pool_observed_total counts log events, not trades I wrote the Help as "Trades observed by the bench pool subscription" in #2811 and then read the counter back as a trade rate while checking the new alert rules. On EVM it is neither. eth_subscribe on a pool address delivers every event the pool emits (Swap, Mint, Burn, Collect), so one swap can arrive as several. Measured on the BNB pool: 49,672 events an hour against roughly 18,380 swaps, a factor of 2.7. Solana logsSubscribe is per transaction, so there the two coincide, which is why the mislabel survived: every number I had checked it against was Solana. Help string only, no behaviour change. The counter is still exactly right for what the race filter uses it for, which is telling a live pool subscription from a dead one, and for the two alert rules added today that test it against zero. It is wrong only as a trade count, which is how I was about to read it. Rides the next harness deploy; not worth one of its own. Co-Authored-By: Claude Opus 5 (1M context) --- harnesses/aggregator-head-lag/cmd/script/metrics.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/harnesses/aggregator-head-lag/cmd/script/metrics.go b/harnesses/aggregator-head-lag/cmd/script/metrics.go index 2ff6cc59f..508028184 100644 --- a/harnesses/aggregator-head-lag/cmd/script/metrics.go +++ b/harnesses/aggregator-head-lag/cmd/script/metrics.go @@ -238,7 +238,15 @@ func init() { headLagPoolSeen = prometheus.NewCounterVec( prometheus.CounterOpts{ Name: "head_lag_pool_observed_total", - Help: "Trades observed by the bench pool subscription, per chain.", + // Log EVENTS, not trades, and the difference is a factor of + // several on EVM: eth_subscribe on a pool address delivers every + // event it emits (Swap, Mint, Burn, Collect), so one swap can + // arrive as several. Measured on the BNB pool: 49,672 events an + // hour against roughly 18,380 swaps. Solana logsSubscribe is per + // transaction, so there the two coincide. Use it to tell a live + // subscription from a dead one, never as a trade count. + Help: "Log events delivered by the bench pool subscription, per chain. " + + "Several per swap on EVM chains; one per transaction on Solana.", }, []string{"chain"}, )