Today, awaitwhat code runs in-process, in-interpreter; the dependency must be added in advance.
Linux has tools to instrument other (already running) processes: bpftrace and oprofile
Links: https://github.com/iovisor/bcc
What's proper: usdt/uprobe/uretprobe?
Example: https://github.com/iovisor/bcc/blob/master/examples/cpp/RecordMySQLQuery.cc
More links: http://www.brendangregg.com/blog/2019-01-01/learn-ebpf-tracing.html