#35368 tracing: add block header and compact block tracepoints
https://github.com/bitcoin/bitcoin/pull/35368 · · +369/-6 in 6 files, 2 commits · labels: Needs rebase
Goal
- Expose compact block reconstruction and header arrival metrics via structured USDT tracepoints
- Provide telemetry tools reliable real-time performance data without fragile debug log scraping
This pull request introduces two new USDT tracepoints: `net:block_header`, which fires when a valid block header arrives via headers or cmpctblock messages, and `net:compact_block_reconstructed`, which fires upon successful compact block reconstruction before validation. It also refactors `PartiallyDownloadedBlock` to extract reconstruction statistics into a dedicated struct, adds functional USDT test coverage, and documents the tracepoints in `doc/tracing.md`.
Problem: Compact block relay performance depends heavily on mempool overlap, extra-transaction pool availability, and peer responsiveness. Today, detailed reconstruction statistics are only available through string-based debug logging, which is brittle, difficult for automated telemetry to parse, and inefficient for continuous real-time monitoring.
Category: P2P (#43 of 65)
P3 · new feature
- P3 because it improves compact block relay observability for research and monitoring tools
- It does not alter P2P network behavior or fix security, DoS, or stability bugs
The PR provides useful, structured observability for compact block relay performance, aiding network health monitoring and research tools like peer-observer without the overhead of debug logging. However, it does not alter P2P network behavior, fix bugs, or address DoS resistance, making it worthwhile but deferrable.
Membership: Instruments compact block reconstruction and header arrival logic in net_processing and blockencodings.
Factors: security/stability 0, bug 0, performance 0, user value 1, leverage 0
Reviewability: Stale: Needs rebase
- Needs rebase due to merge conflicts with master
- Author has been inactive for several months and has not responded to rebase requests
The branch has merge conflicts with master and the author has been inactive for 113 days, leaving a rebase request unanswered.
Author status: silent since May 2026; has not rebased following requests
Resolved concerns:
- 0xB10C and stickies-v raised whether tracing work should wait for the broader IPC-based tracing discussion (#35142), but the author argued that IPC tracing is not a drop-in synchronous replacement for high-frequency kernel tracepoints today, with no subsequent pushback.
- m4ycon suggested exposing missing transaction IDs over the tracepoint, but 0xB10C pointed out that passing variable-length lists over USDT is impractical and logging remains appropriate for deep debugging.
Agreement: Positive
- General support for adding structured observability to compact block relaying
- Concept approval because it replaces brittle debug log parsing in monitoring tools (0xB10C, m4ycon)
- Questioned whether to pause USDT additions pending IPC tracing design (0xB10C, stickies-v)
Concept ACKs from 0xB10C and m4ycon; questions about waiting for IPC tracing were answered without pushback.
Two contributors working on P2P telemetry expressed Concept ACKs because structured data avoids fragile log scraping. Questions regarding the future of USDT vs IPC tracing were answered by the author and no blocking objections remain.
- 0xB10C: 'Concept ACK on exposing this data. In peer-observer... m4ycon has been working on reading very similar information for the debug log... obviously brittle.'
- m4ycon: 'Concept ACK. Also a suggestion on additional info.'
- stickies-v: 'I agree it would make more sense to clarify that [IPC tracing] first before adding more tracepoints.'
- w0xlt: explained why IPC tracing is a longer-term project with different synchronization tradeoffs and should not block small USDT additions.
Review verdicts (DrahtBot): 0
Files
272 lines under test/bench/ci.
- test/functional/interface_usdt_net.py +257/-2
- src/net_processing.cpp +42/-1
- doc/tracing.md +30/-0
- src/blockencodings.cpp +15/-3
- src/test/blockencodings_tests.cpp +13/-0
- src/blockencodings.h +12/-0
Card
This PR introduces two USDT tracepoints, net:block_header and net:compact_block_reconstructed, to emit structured compact block relay and header statistics without requiring debug log parsing. It solves an observability bottleneck for researchers and node operators analyzing compact block propagation and peer behavior. The change has received Concept ACKs from 0xB10C and m4ycon, who noted its value for peer monitoring tools. It is currently Stale, needing a rebase to resolve merge conflicts with master after three months of author silence.