lightning icon indicating copy to clipboard operation
lightning copied to clipboard

Opentracing library

Open cdecker opened this issue 1 year ago • 2 comments

This is as experimental as it gets, but I had some fun trying to shoehorn a tracing library into CLN. Putting it here so I don't lose it, and hopefully get some feedback on the API.

Ideally I'd love to integrate closer with io_loop, namely having it suspend and resume based on the io_plan automatically so users don't have to when suspending on a higher level. Then it boils down to starting and ending spans at the entry and exit point of logical calls.

cdecker avatar Aug 03 '22 15:08 cdecker

we use ebpf usdt tracepoints in bitcoin, maybe something to check out:

https://github.com/bitcoin/bitcoin/blob/master/doc/tracing.md

super lightweight and has linux kernel support.

jb55 avatar Aug 22 '22 18:08 jb55

Yeah, I was looking into that, however it doesn't mesh too well with the async IO loop we're using, when spans live across several context switches. Ideally I'd like to hook into io_loop to suspend and resume spans automatically so instrumenting something on the user side just boils down to using span_start and span_end.

Either way, the majority of the code here is to manage parent spans anyway and do span lookups by context object, which we'd likely require for eBPF variants too (though we can externalize the reporting of the spans, which is indeed a big win).

cdecker avatar Aug 23 '22 11:08 cdecker