I know this doesn't help for Python, but... You can do that in Java with instrumentation. Things like ByteBuddy [1] or ReactorDebugAgent [2] will add debugging statements into your code without you having to touch anything.
If you want more advanced, then you can look at libstapsdt [3] which enables JVM applications to create USDT probes.
[1] https://tersesystems.github.io/terse-logback/guide/instrumen...
[2] https://github.com/reactor/reactor-tools#reactor-debug-agent...
Depends on which flavour of Linux one goes by.
https://docs.oracle.com/en/operating-systems/oracle-linux/dt...
Regarding BPF, the book is a must have for anyone doing serious stuff with it.
https://www.informit.com/store/bpf-performance-tools-9780136...
I would strongly doubt the sanity of anyone getting their linux distro from oracle.
Luckily most Fortune 500 management boards think otherwise, so I get to enjoy nice tools.
In cases like HPC and other performance-centric workloads, mainline kernel just doesn't have the hardware support needed for more exotic stuff like Infiniband and Mellanox cards, high-end SSD etc. Oracle got tired of waiting for sufficient support to be included which is why IIRC OEL UEK was created.
If such hardware isn't being used, then yes, sanity should be questioned for supporting Uncle Larry's Linux.
Sadly $dayjob runs servers on linux and isn't going to merge the dtrace patches in there, and python's systemtap probes are… limited.
Apparently bcc can hook into USDT probes though, I should look into that: https://ish-ar.io/python_ebpf_tracing/