Commit c0df013
committed
core: p2p message counters, tx-pool gauges and embedded-timestamp diagnostics
Not one of the canonical p2pool pool-protocol message types emitted anything
at any verbosity, and m_known_txs.size() was exposed nowhere -- no log, no
dashboard field, no JSON. A live investigation had to guess, and a log-grep
returning zero was misread as "not implemented" for code that was fully wired
and running. A grep of zero is not evidence when nothing ever logs.
Adds core/p2p_message_stats.hpp: a process-wide struct of relaxed atomics,
incremented at the two choke points every pool message must pass through --
pool::NodeBridge::handle() inbound and pool::Peer::write() outbound. Both are
shared code, so every coin lane is instrumented without touching a single
per-coin protocol file, and the numbers mean the same thing across coins.
Read back through a new read-only endpoint, GET /p2p_stats:
messages.<type>.{in,out} per-type wire counters for version, verack, ping,
pong, addrme, addrs, getaddrs, shares, sharereq,
sharereply, have_tx, losing_tx, remember_tx,
forget_tx, bestblock, plus an unknown bucket
totals.{in,out}
txpool.known_txs_size m_known_txs.size()
txpool.known_txs_order_size m_known_txs_order.size(), null where the
lane has no recency deque (DASH)
txpool.last_have_tx_advert_size size of the last have_tx put on the wire
txpool.last_losing_tx_advert_size
txpool.have_tx_adverts_sent
sharechain_timestamps.tip_lag_seconds now - tip share_data.timestamp
sharechain_timestamps.saturation_fraction share of the last 100 embedded
deltas pinned to the clip bound
sharechain_timestamps.clip_upper_bound 2*SHARE_PERIOD-1 (39 s on DASH)
sharechain_timestamps.{delta_samples,delta_saturated,tip_embedded_timestamp}
The txpool block settles whether TXPOOL=0 on a peer dashboard means our pool
is genuinely empty or the advert is being suppressed.
The timestamp block exists because the aggregate gauges proved untrustworthy.
Upstream p2pool clips embedded share timestamps to
[prev+1, prev+2*SHARE_PERIOD-1] (data.py:239-242); once real cadence outruns
that bound the embedded clock saturates, the difficulty retarget goes blind to
hashrate and the floor decays. A 6.81 hour embedded lag was measured live.
pool_hash_rate and min_difficulty are computed from that same saturated
history, so they report floor decay rather than the pool -- tip lag and
saturation fraction are the honest early-warning pair.
DASH publishes the timestamp diagnostics from publish_snapshot() (already
under the exclusive tracker lock, bounded at 101 chain lookups per think
cycle) and the tx-pool gauges from the 10 s advert sweep; btc/ltc/dgb publish
their tx-pool gauges from prune_shares().
Observability only: counters and read-only fields. No consensus, minting,
share bytes or peer behaviour changes. Per-message logging stays off by
default behind a flag nothing in-tree enables.
Tests folded into the EXISTING allowlisted core_test target (never a new
add_executable -- that is the "Not Run" trap): 12 cases over the command
mapping including the NUL-padded wire form, the per-direction counters, and
the saturation detector.1 parent 0170f4c commit c0df013
12 files changed
Lines changed: 800 additions & 5 deletions
File tree
- docs
- src
- core
- test
- impl
- btc
- dash
- dgb
- ltc
- pool
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
107 | 165 | | |
108 | 166 | | |
109 | 167 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
30 | 90 | | |
31 | 91 | | |
32 | 92 | | |
| |||
380 | 440 | | |
381 | 441 | | |
382 | 442 | | |
| 443 | + | |
| 444 | + | |
383 | 445 | | |
384 | 446 | | |
385 | 447 | | |
| |||
0 commit comments