Announcing v1 of OpenTelemetry Go Compile-Time Instrumentation | OpenTelemetry<br>Ask AI (⌘-K)" class="td-search__input form-control td-search-input" placeholder="Ask AI or search…" aria-label="Ask AI or search…" autocomplete=off>
View Markdown<br>View page source<br>Edit this page<br>Create child page<br>Create documentation issue<br>On this page
Announcing v1 of OpenTelemetry Go Compile-Time Instrumentation<br>By Kemal Akkoyun (Datadog) |<br>Thursday, July 16, 2026<br>If you write Java, Python, Node.js, or .NET, you have been able to add<br>OpenTelemetry to an application without editing its code for years: attach an<br>agent at startup and telemetry starts flowing. Go has been the exception. A Go<br>program compiles to a single static binary with no runtime to hook into at<br>startup, so Go developers have had to instrument by hand or reach for an<br>out-of-process eBPF agent.<br>That gap is closing. The OpenTelemetry community is announcing the first stable<br>release of<br>OpenTelemetry Go Compile-Time Instrumentation.<br>When we announced this SIG at the<br>start of 2025, Alibaba and Datadog joined forces to build one unified,<br>vendor-neutral way to instrument Go at build time. v1 is that project’s first<br>stable release.<br>If you build and run Go services, you can change a single line in how you build<br>your binary or container image and get OpenTelemetry traces and metrics for your<br>application and its dependencies, with no code changes. For a platform engineer<br>or an SRE, that means you can add observability to services across your fleet<br>without waiting for every team to instrument their own code.<br>What is Go Compile-Time Instrumentation?<br>Go compiles to a single static binary, which has long made automatic<br>instrumentation harder than in interpreted languages. This project hooks into<br>the standard Go toolchain during the build (through its -toolexec mechanism)<br>and injects OpenTelemetry instrumentation into your code, its dependencies, and<br>the standard library as they are compiled. There is no separate agent and<br>nothing to attach at runtime.<br>For you, that means telemetry with no source-code changes: the instrumentation<br>is compiled directly into your binary. Your application code stays free of<br>instrumentation concerns, and you get coverage for third-party libraries you<br>don’t own.<br>Key capabilities in v1<br>Zero-code instrumentation : instrument an application and its dependencies<br>without manual code changes.<br>Compile-time injection, no added runtime overhead : instrumentation is<br>built into the binary instead of attached at runtime.<br>Third-party and standard-library coverage : instrument dependencies and<br>standard-library packages you don’t own.<br>Supported instrumentations in v1 : common libraries and frameworks<br>including net/http, database/sql, gRPC, Redis, and Go runtime metrics,<br>with more added regularly. See the<br>supported libraries<br>for the full, current list.<br>Rule-based and extensible : add support for new libraries through the SIG’s<br>instrumentation-rule format. See the<br>instrumentation guide<br>and the<br>rules reference.<br>Semantic-convention compliance : emitted telemetry follows current<br>OpenTelemetry semantic conventions.<br>CI/CD friendly : run the tool at development time or drop it into your<br>build pipeline.<br>Getting started<br>The project ships a command-line tool called otelc that wraps the standard Go<br>toolchain. The change to your build is a single line: run otelc go build where<br>you used to run go build. Everything after go is forwarded to the toolchain,<br>so the rest of your build stays the same.<br>Install it with go install:<br>go install go.opentelemetry.io/otelc/tool/cmd/otelc@latest
Then build your application through it:<br>otelc go build -o myapp .
If you’d rather not change your build command, run otelc setup once to prepare<br>the module, then point the Go toolchain at otelc through GOFLAGS and keep<br>running go build as usual:<br>otelc setup<br>export GOFLAGS="${GOFLAGS} '-toolexec=otelc toolexec'"<br>go build -o myapp .
By default, otelc discovers the supported libraries in your module and<br>instruments them automatically, with no configuration and no code changes. The<br>same swap works in a container build: install otelc in your build stage and<br>replace the go build line in your Dockerfile with otelc go build. For the<br>full walkthrough, see the<br>compile-time instrumentation documentation.<br>When should you use it?<br>If you write or operate Go services, you now have three complementary ways to<br>get OpenTelemetry telemetry, and compile-time instrumentation is the third<br>option promised in the founding post:<br>Compile-time instrumentation (this project) : best when you can rebuild the<br>application and want no code changes, no added runtime overhead, and coverage<br>of dependencies and the standard library.<br>eBPF instrumentation<br>(OpenTelemetry eBPF Instrumentation, or OBI) : best<br>when you can’t rebuild the binary, or want zero-code, multi-language<br>instrumentation from outside the process.<br>Manual instrumentation with the<br>OpenTelemetry Go API : best for custom spans...