aboutsummaryrefslogtreecommitdiff
path: root/doc/tracing.md
diff options
context:
space:
mode:
author0xb10c <0xb10c@gmail.com>2021-05-20 16:54:54 +0200
committer0xb10c <0xb10c@gmail.com>2021-07-27 17:12:16 +0200
commit4224dec22baa66547303840707cf1d4f15a49b20 (patch)
tree467d8bc70b3a3d3ada1fc4a2281ff2725031f09d /doc/tracing.md
parent469b71ae629228b2591a55831817a0e5fad89360 (diff)
downloadbitcoin-4224dec22baa66547303840707cf1d4f15a49b20.tar.xz
tracing: Tracepoints for in- and outbound P2P msgs
Can be used to monitor in- and outbound node traffic. Based on ealier work by jb55. Co-authored-by: William Casarin <jb55@jb55.com>
Diffstat (limited to 'doc/tracing.md')
-rw-r--r--doc/tracing.md40
1 files changed, 40 insertions, 0 deletions
diff --git a/doc/tracing.md b/doc/tracing.md
index 4c472b4154..026946b018 100644
--- a/doc/tracing.md
+++ b/doc/tracing.md
@@ -53,6 +53,46 @@ be found in [contrib/tracing].
The currently available tracepoints are listed here.
+### Context `net`
+
+#### Tracepoint `net:inbound_message`
+
+Is called when a message is received from a peer over the P2P network. Passes
+information about our peer, the connection and the message as arguments.
+
+Arguments passed:
+1. Peer ID as `int64`
+2. Peer Address and Port (IPv4, IPv6, Tor v3, I2P, ...) as `pointer to C-style String` (max. length 68 characters)
+3. Connection Type (inbound, feeler, outbound-full-relay, ...) as `pointer to C-style String` (max. length 20 characters)
+4. Message Type (inv, ping, getdata, addrv2, ...) as `pointer to C-style String` (max. length 20 characters)
+5. Message Size in bytes as `uint64`
+6. Message Bytes as `pointer to unsigned chars` (i.e. bytes)
+
+Note: The message is passed to the tracepoint in full, however, due to space
+limitations in the eBPF kernel VM it might not be possible to pass the message
+to user-space in full. Messages longer than a 32kb might be cut off. This can
+be detected in tracing scripts by comparing the message size to the length of
+the passed message.
+
+#### Tracepoint `net:outbound_message`
+
+Is called when a message is send to a peer over the P2P network. Passes
+information about our peer, the connection and the message as arguments.
+
+Arguments passed:
+1. Peer ID as `int64`
+2. Peer Address and Port (IPv4, IPv6, Tor v3, I2P, ...) as `pointer to C-style String` (max. length 68 characters)
+3. Connection Type (inbound, feeler, outbound-full-relay, ...) as `pointer to C-style String` (max. length 20 characters)
+4. Message Type (inv, ping, getdata, addrv2, ...) as `pointer to C-style String` (max. length 20 characters)
+5. Message Size in bytes as `uint64`
+6. Message Bytes as `pointer to unsigned chars` (i.e. bytes)
+
+Note: The message is passed to the tracepoint in full, however, due to space
+limitations in the eBPF kernel VM it might not be possible to pass the message
+to user-space in full. Messages longer than a 32kb might be cut off. This can
+be detected in tracing scripts by comparing the message size to the length of
+the passed message.
+
## Adding tracepoints to Bitcoin Core
To add a new tracepoint, `#include <util/trace.h>` in the compilation unit where