odigos-io/offsets-tracker

Generating offsets from local Go version

damemi opened this issue · 5 comments

Is it possible to run this just based on my local Go version, rather than downloading them remotely? It would be nice to auto-detect what version I'm running (or for example, when running an app in a golang container) and make this part of the build stage for adding otel auto-instrumentation to an app.

I like this idea, I only have one question: how would you deal with new Go versions that come out?
Will we need to update the build for every new version?
Currently, offsets-tracker queries https://go.dev/dl/?mode=json&include=all to get all the available versions and tracks offset for every released version.

If I update my go version, I could just re-run offsets-tracker right? Or if I'm building for a container I could make the generator part of my build pipeline so it always runs at build time and I don't need to track other Go versions

Yes, but then it will generate offsets only for the standard library of that specific Go version. The automatic instrumentation may be compiled with a different Go version than the one used in the container.

If I am generating the offsets, won't I need to recompile the automatic instrumentation anyway? Or does the automatic instrumentation just read from the file at runtime? (sorry if this is an obvious question, still learning how the auto-instro agent works)

Either way, in an end-to-end environment that I control it should be manageable to ensure the automatic instrumentation is compiled with the same version as my program

Currently the agent works as follows:

  1. Find the target process
  2. Detect compiled go version + versions of other libraries (this data is left by the go linker and can be easily read)
  3. Find the relevant offsets in the json file according to the specific versions used by the target application
  4. Use those offsets in the eBPF programs for instrumentation

Anyway, tracking the local Go version sounds like a good feature to me.