5 ms·
Couldn't this be injected into the runtime so that no code changes are required? Perhaps really performance critical stuff could have a "notrace" annotation.
by lambda_garden 3y ago
Couldn't this be injected into the runtime so that no code changes are required?
Perhaps really performance critical stuff could have a "notrace" annotation.
- thinkharderdev 3y agoSure, and a lot of tools will do this in one way or another. Either instrument code directly or provide annotations/macros to trace a specific method (something like tokio-tracing in the Rust ecosystem). However, tracing literally every method call would probably be prohibitively expensive so typically you have either: 1. Instrumentation with "understands" common frameworks/libraries and knows what to instrument (eg request handlers in web frameworks) 2. Full opt-in. They make it easy to add a trace for a method invocation with a simple annotation but nothing gets instrumented by default
- austinsharp 3y agoYes, OTel has autoinstrumentation libraries for some language that can pick up a fair amount by default. Though it's unlikely that that would ever be sufficient, it's a nice start. For Java: https://opentelemetry.io/docs/instrumentation/java/automatic/ https://opentelemetry.io/docs/instrumentation/java/automatic...
- imiric 3y agoThere are several projects that leverage eBPF for automatic instrumentation[1]. How accurate and useful these are vs. doing this manually will depend on the use case, but I reckon the automatic approach gets you most of the way there, and you can add the missing traces yourself, so if nothing else it saves a lot of work. [1]: https://ebpf.io/applications/ https://ebpf.io/applications/
- pondidum 3y agoYes, and itel has instrumentation libraries which do this. However, no automatic instrumentation can do everything for you; it can't know what are all the interesting properties or things to add as attributes. But adding tracing automatically to SQL clients, web frameworks etc is very valuable