Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating offsets from local Go version #4

Open
damemi opened this issue Nov 1, 2022 · 5 comments
Open

Generating offsets from local Go version #4

damemi opened this issue Nov 1, 2022 · 5 comments

Comments

@damemi
Copy link

damemi commented Nov 1, 2022

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.

@edeNFed
Copy link
Contributor

edeNFed commented Nov 2, 2022

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.

@damemi
Copy link
Author

damemi commented Nov 2, 2022

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

@edeNFed
Copy link
Contributor

edeNFed commented Nov 2, 2022

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.

@damemi
Copy link
Author

damemi commented Nov 2, 2022

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

@edeNFed
Copy link
Contributor

edeNFed commented Nov 2, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants