@@ -53,34 +53,20 @@ usdt:lightningd/lightningd:lightningd:span_start
53
53
usdt:lightningd/lightningd:lightningd:span_suspend
54
54
```
55
55
56
- We want to attach to the ` span_emit ` probe, as that's the one getting the opentracing-compatible JSON string passed as an argument, and we'd like to extract that.
57
-
58
- ``` bash
59
- $ export BPFTRACE_STRLEN=200
60
- $ sudo -E bpftrace -e ' U:../lightning/lightningd/lightningd:span_emit {printf("%s\n", str(arg1, 10240));}'
61
-
62
- Attaching 1 probe...
63
- [{" id" : " 5006000000000000" , " name" : " lightningd/jsonrpc" , " timestamp" : 1690202283751653, " duration" : 154," localEndpoint" : { " serviceName" : " lightningd" }, " tags" : {" method" : " sql" }, " traceId" : " b7f9b1
64
- [{" id" : " 5106000000000000" , " name" : " lightningd/jsonrpc" , " timestamp" : 1690202283752515, " duration" : 146," localEndpoint" : { " serviceName" : " lightningd" }, " tags" : {" method" : " listnodes" }, " traceId" : "
65
- [{" id" : " 8206000000000000" , " name" : " lightningd/jsonrpc" , " timestamp" : 1690202283759889, " duration" : 657," localEndpoint" : { " serviceName" : " lightningd" }, " tags" : {" method" : " dev-memleak" }, " traceId" :
66
- [{" id" : " 8306000000000000" , " name" : " lightningd/jsonrpc" , " timestamp" : 1690202283784095, " duration" : 135," localEndpoint" : { " serviceName" : " lightningd" }, " tags" : {" method" : " dev-report-fds" }, " traceI
67
- [{" id" : " 8406000000000000" , " name" : " lightningd/jsonrpc" , " timestamp" : 1690202283785116, " duration" : 204," localEndpoint" : { " serviceName" : " lightningd" }, " tags" : {" method" : " stop" }, " traceId" : " f6d42
68
- [{" id" : " 3100000000000000" , " name" : " lightningd/jsonrpc" , " timestamp" : 1690202283860017, " duration" : 770," localEndpoint" : { " serviceName" : " lightningd" }, " tags" : {" method" : " dev-memleak" }, " traceId" :
69
- [{" id" : " 3200000000000000" , " name" : " lightningd/jsonrpc" , " timestamp" : 1690202283992271, " duration" : 155," localEndpoint" : { " serviceName" : " lightningd" }, " tags" : {" method" : " dev-report-fds" }, " traceI
70
- [{" id" : " 3300000000000000" , " name" : " lightningd/jsonrpc" , " timestamp" : 1690202283993745, " duration" : 370," localEndpoint" : { " serviceName" : " lightningd" }, " tags" : {" method" : " stop" }, " traceId" : " 92576
71
- [{" id" : " 5206000000000000" , " name" : " lightningd/jsonrpc" , " timestamp" : 1690202284070125, " duration" : 911," localEndpoint" : { " serviceName" : " lightningd" }, " tags" : {" method" : " dev-memleak" }, " traceId" :
72
- [{" id" : " 5506000000000000" , " name" : " lightningd/jsonrpc" , " timestamp" : 1690202284313462, " duration" : 62," localEndpoint" : { " serviceName" : " lightningd" }, " tags" : {" method" : " dev-report-fds" }, " traceId
73
- [{" id" : " 5606000000000000" , " name" : " lightningd/jsonrpc" , " timestamp" : 1690202284314014, " duration" : 117," localEndpoint" : { " serviceName" : " lightningd" }, " tags" : {" method" : " stop" }, " traceId" : " b7f9b
74
- [{" id" : " 5406000000000000" , " name" : " plugin/bitcoind" , " timestamp" : 1690202284312469, " duration" : 4774," localEndpoint" : { " serviceName" : " lightningd" }, " parentId" : " 5306000000000000" ," tags" : {" method
75
- [{" id" : " 5306000000000000" , " name" : " extend_tip" , " timestamp" : 1690202284312428, " duration" : 4902," localEndpoint" : { " serviceName" : " lightningd" }, " tags" : {}, " traceId" : " b7f9b1e8af12d252" }]
76
-
77
- ` ` `
78
-
56
+ There is a sample exporter that can be used to instrument a single
57
+ binary, batch the spans it receives and submit them as a batch to an
58
+ ` otelcol ` or ` tempo ` instance in [ contrib/cln-tracer] [ cln-tracer ]
59
+ using the zipkin format for spans and traces.
79
60
61
+ [ cln-tracer ] : https://github.com/ElementsProject/lightning/tree/master/contrib/cln-tracer
80
62
81
63
64
+ Notice that due to a [ limitation] [ bpftracer305 ] in the way the eBPF
65
+ script is handled you'll at most get the first 495 bytes of the
66
+ payload. This is due to the 512 byte limitation for eBPF programs out
67
+ of the box.
82
68
83
- Notice that due to a [limitation]( https://github.com/iovisor/bpftrace/issues/305) in ` bpftrace ` you ' ll at most get the first 200 bytes of the payload. If you write your own exporter you ' ll be able to specify the size of the buffer that is being used, and can extract the entire span.
69
+ [ bpftracer ] : https://github.com/iovisor/bpftrace/issues/305
84
70
85
71
## Tracing Overhead
86
72
0 commit comments