Can recommend Opentelemetry if you need a more comprehensive tool like this.
There is a whole library of so called instrumentation that can monkeypatch standard functions and produce traces of them.
Traces can also propagate across process and rpc, giving you a complete picture, even in a microservice architecture.