OpenTelemetry Go Compile-Time Instrumentation is a tool that automatically instruments your Go applications with OpenTelemetry at compile-time. No manual code changes required.
- Zero-code instrumentation - Automatically instrument your entire application without modifying source code
- Third-party library support - Instrument dependencies and libraries you don't control
- Complete decoupling - Keep your codebase free from instrumentation concerns
- Flexible deployment - Integrate at development time or in your CI/CD pipeline
-
Clone and build the tool
git clone https://github.com/open-telemetry/opentelemetry-go-compile-instrumentation.git cd opentelemetry-go-compile-instrumentation make build -
Try the demo
make demo
-
Use with your application
# Option 1: Direct build ./otel go build -o myapp . # Option 2: Install as tool dependency (Go 1.24+) go get -tool github.com/open-telemetry/opentelemetry-go-compile-instrumentation/cmd/otel go tool otel go build -o myapp .
The tool uses compile-time instrumentation through:
- Trampoline Code Injection - Injects lightweight hook points into target functions
- Function Pointer Redirection - Automatically generates and links hooks to monitoring code via
//go:linkname - Custom Toolchain Integration - Intercepts compilation using
-toolexecflag
This approach provides dynamic instrumentation without runtime overhead or invasive code modifications.
- User Experience Design - Detailed UX documentation and configuration options
- Implementation Details - Technical architecture and internals
- API Design - API structure and project organization
- Contributing Guide - How to contribute to the project
Learn more about the project from these presentations:
- Slack: Join #otel-go-compt-instr-sig
- Meetings: Check the meeting notes for SIG schedules
- GitHub: open-telemetry/opentelemetry-go-compile-instrumentation
Note: This project is currently in active development and not yet ready for production use.
For the latest updates and development progress, follow the project on GitHub and join the community discussions.