OpenTelemetry for Go: eBPF or compile-time instrumentation

Go has no bytecode agent, so teams choose between the Go SDK, zero-code eBPF tracing with OBI, and compile-time instrumentation, often combined through the Auto SDK. This page explains the trade-offs and setup order.

On this page

Why Go services need a different path to OpenTelemetry

Go services compile into static binaries, so there is no Java-style agent to attach at startup and no bytecode to rewrite. Teams with a Go fleet still need traces across services, but they rarely want to edit every handler before they can see anything. The first decision is how much of that coverage must come from code you write and how much can come from instrumentation that sits outside the application. OpenTelemetry gives you one set of APIs, SDKs and wire formats, but it does not store or display telemetry, so you also need a backend chosen separately. What is OpenTelemetry? describes that split between generating and exporting telemetry and the tools that store it.

The OpenTelemetry Go docs list traces and metrics as stable and logs as a release candidate, so a plan that depends on Go logs should be checked against the current status before rollout. Three documented routes apply to Go. The Go SDK, used with manual spans, is the route for business operations, custom attributes and anything only application code knows. OpenTelemetry eBPF Instrumentation (OBI) is the zero-code route, observing traffic from outside the process without code changes. Go compile-time instrumentation is the third route, adding instrumentation when the binary is built. The Go zero-code instrumentation docs cover the requirements and limits of the two zero-code options.

The Auto SDK is the piece that lets these routes coexist. It is meant to combine manual spans your developers write with spans produced by eBPF, so one trace can show both the framework calls and the business steps inside a request. Confirm with your platform team which Linux kernel versions, container runtimes and privileges your hosts allow before you pick eBPF, because those constraints decide whether the zero-code route is available at all. A staged plan usually starts with OBI or compile-time instrumentation for coverage at service edges, then adds manual spans where the code has context the agent cannot see.

Which Go instrumentation route fits which service

This table compares the Go SDK, OBI eBPF tracing and Go compile-time instrumentation on what each captures, the code changes they need, and the privileges and runtime they require. Read each row against your own service and environment, because the right route depends on what you can change in code and what your hosts permit, and the official zero-code docs must confirm current support.

CriterionGo SDK (manual)OBI eBPF tracingCompile-time instrumentation
What it capturesOnly the spans, metrics and logs your code creates, plus any library instrumentation you addZero-code trace data for supported protocols observed at the process and kernel boundaryAutomatic spans added during the build for supported Go libraries, confirm the list in the docs
Code changes requiredYes: SDK setup, span creation, attributes and context propagation in your codeNone to application source; the agent is deployed beside the serviceNo source changes to business logic, but the build toolchain and build step change
Privileges neededNone beyond normal application runtimeElevated kernel access to load eBPF programs, typically root or equivalent capabilities; confirm exact capabilities in the OBI docsNone at runtime beyond normal application runtime; the build pipeline needs the instrumentation tooling
Runtime environmentAny Go runtime and deployment, including restricted containers and serverlessLinux hosts or nodes where the kernel supports the required eBPF features; confirm kernel and architecture supportStandard Go build pipelines; confirm supported Go versions and build flags against the official docs
Business spans and attributesYes: order IDs, tenant, pricing decisions and other domain context only code can addNo; eBPF sees requests and calls, not your domain meaningNo; add these with manual spans, which can be mixed through the Auto SDK
Mixing with manual spansNativeCombine with manual spans through the Auto SDK so both appear in one traceCompatible with manual spans; agree the trace structure before rollout
Good first choice whenYou own the code, need business context or run in environments that forbid kernel accessYou cannot change the code and your hosts allow eBPF agentsYou can change the build and want library spans without runtime agents

How the environment changes the choice

When your teams own the source and can rebuild services, the Go SDK is usually the most complete path. Manual instrumentation lets you name business operations, add attributes that only application code knows, and control which libraries are wrapped. Compile-time instrumentation is the second option here, because it adds telemetry during the build without hand-editing every call site. Zero-code eBPF tracing can still run alongside these services to cover edges and inter-service calls that the code does not reach.

  • Full control of span names: the SDK lets you decide what a business operation is called and which attributes it carries.
  • Build pipeline change: compile-time instrumentation adds a step to your Go toolchain, so the build team must own its upgrades.
  • Library coverage: check which frameworks and clients your services use and confirm each one is covered by the path you pick.
  • Ongoing maintenance: manual spans need review whenever handlers or business logic change.
  • Mixed coverage: eBPF spans and SDK spans can coexist, and the Auto SDK is the documented way to combine them.

Confirm with the owning team which services can be rebuilt on a regular schedule, and check the current status of each option in the Go zero-code docs.

How to set up Go instrumentation in order

This sequence takes a Go estate from an uneven picture of services to traces that reach a Collector with correct parent-child links, using the route that fits each service. Each step closes with a check so the next one starts from a known state.

  1. Inventory Go services and their runtimes

    List every Go service that needs traces, with its Go version, build method, deployment target (VM, container, Kubernetes or serverless), and whether it already calls other services over HTTP or gRPC. Note which services are not yours to rebuild, such as vendor binaries or services built by another team. Confirm the Go version of each service against the version range the OpenTelemetry Go docs currently list as supported. The step is done when every service has one row in a shared inventory and each row names an owner.

  2. Choose the route for each service

    For each inventory row, pick one route: the Go SDK for services whose source you can change, compile-time instrumentation for services you can rebuild with a build step but prefer not to edit, or OBI for binaries you cannot rebuild and want traced without code changes. Record the reason beside each choice, such as access to source, build pipeline control, or need for business attributes that only code can add. The check is a decision table where every service has one route and one owner, and the team agrees that the table matches the rollout order.

  3. Install the Go SDK or configure the zero-code path

    For SDK services, add the OpenTelemetry Go SDK and initialize a tracer provider in the service's startup code, with instrumentation libraries for the HTTP server, client and database calls the service uses. For compile-time or OBI services, set up the build step or deploy the OBI component on the host or cluster, following the Go zero-code documentation for the version you chose. The check is a local run that produces at least one span per inbound request, visible in the console exporter or a test Collector, before any production wiring starts.

  4. Set resource attributes and export to the Collector

    Set service.name, service.version and deployment environment on the resource so spans are attributable, and point the OTLP exporter at a Collector endpoint through the standard OpenTelemetry environment variables or code configuration. Bind the Collector's receiver to an address reachable only from the service network, since recent Collector releases bind server components to localhost by default and other settings must be deliberate. Ask your platform team which Collector deployment pattern (agent or gateway) will receive the traffic. The check is that each service appears in the backend under its own service name with the expected environment label.

  5. Enable the Auto SDK where both span types are needed

    Where a service needs eBPF spans for framework and library calls and manual spans for business logic, enable the Auto SDK so both kinds of span share one trace context. Confirm with the OpenTelemetry Go zero-code docs which Auto SDK setup applies to your OBI version and Go version, and test it against a service that has both kinds of calls. Keep the list of manually instrumented operations short and named consistently. The check is a single request trace that contains both an eBPF-generated span and a manual span in the same tree.

  6. Verify parent-child links across services

    Send a request that crosses at least two Go services and confirm that the caller's span is the parent of the callee's span, that both share one trace ID, and that the context propagates through queues or background goroutines you own. Check the spans for missing parents, duplicated spans from both SDK and OBI on the same operation, and attributes that expose sensitive values. Record the results in a short test sheet per service. The step is done when a cross-service trace shows the full call tree with no orphaned spans on the paths you tested.

  7. Roll out, monitor and document

    Roll out service by service in the order set in the decision table, starting with a low-risk service, and keep the verification checks as a regression test for each deployment. Confirm with your security team which attributes the redaction processor should remove before traffic reaches the backend. Document each service's route, version, resource attributes and known gaps so the next upgrade of the Go version or OBI can be tested against the same checks. The step is done when every in-scope service passes its check and the documentation is linked from the team's runbook.

How Go telemetry flows from services to the Collector

The path starts in a Go service, where manual SDK spans are created in application code, and in a separate Go process that is instrumented either by eBPF (OBI) or by compile-time instrumentation. The Auto SDK is the hand-off point that merges manual and automatic spans into one trace, so they share context. Spans then leave the host over OTLP to a Collector, which can run as an agent beside the services or as a gateway. Check the trust boundary: the host-side Collector and the network path to the gateway are where authentication, encryption and sensitive-data redaction must be configured before the backend you choose receives anything.

Go spans flow through the Auto SDK and a Collector across the host boundary.

Security and privilege risks of eBPF and compile-time instrumentation

Zero-code eBPF tracing and compile-time instrumentation both change what runs on your hosts and what leaves your services. The cards below cover the privileges, the build and deployment controls, the telemetry content and the Collector endpoints that need explicit decisions before rollout.

Host privileges for eBPF tracing

OBI attaches probes to running processes, which needs elevated kernel-level permissions on the host. Those permissions reach every process the agent can observe, not only the Go service you intend to trace. Before rollout, confirm which capabilities the agent requires on your distribution, which nodes it runs on, and whose change approval covers installing it. Treat the agent as a privileged component in your host inventory and access reviews.

Go zero-code docs

Who can deploy instrumented binaries

Compile-time instrumentation changes the binary itself, so the instrumented artifact becomes part of your software supply chain. Anyone who can push a build or swap a container image can alter what telemetry leaves the service. Restrict build pipelines, require review of instrumentation changes, and verify that deployed images match the reviewed build. Keep the list of people allowed to deploy these artifacts short and documented.

Sensitive data in span attributes

Spans often capture URLs, query strings, headers and database statements, and a manual attribute can carry a customer identifier or a token by accident. Once exported, that data sits in your telemetry backend with different access controls than the source system. Inventory which attributes each service sets, then use the redaction processor in the Collector to remove or mask sensitive keys before export. Check the processor's configuration against real sample spans.

Collector security practices

Collector endpoints and interfaces

A Collector receiver that listens on all interfaces can accept telemetry from hosts that should not reach it. Since Collector v0.110.0, server components bind to localhost by default, but overriding that default in a Kubernetes or gateway setup is common. Set listen addresses explicitly, restrict them with network policy or firewall rules, and enable authentication on receivers that cross a trust boundary. Confirm each receiver's address in the running configuration, not only in the template.

Store and authenticate Collector configuration

The Collector configuration can contain exporter credentials, endpoints and processor rules that reveal how your telemetry is handled. Store it with restricted access and encrypt secrets rather than placing them in plain files. Use authenticator extensions such as OIDC for incoming connections and the oauth2client extension for outgoing exporter requests where the backend supports them. Review who can read or change the configuration as part of normal access reviews.

Collector configuration docs

Minimal Collector builds

The contrib distribution includes many components, and each one adds code you must patch, review and monitor. Use the Collector Builder to compile only the receivers, processors, exporters and extensions your pipelines need. Record the chosen component list with each build, and rebuild when you upgrade so the removed code stays removed. Ask your team to confirm which components they rely on before the build is frozen.

Questions teams ask before choosing Go instrumentation

What drives the cost of instrumenting Go services with OpenTelemetry?

The main drivers are the number of services, how much of each service needs code changes, the host privileges your platform team will grant, the Collector design, and the testing you require before rollout. A fleet of similar services built on one framework costs less to plan than a set of unrelated services with different deployment models. Cost is mostly people time, both for the engagement and for the internal reviews it requires, and it is largely one-time. Ongoing costs recur in Collector upgrades and in keeping instrumentation aligned with new releases. Ask any provider for a quote that lists services in scope, the instrumentation approach for each, the Collector topology, and the test and handover deliverables.

How long does a Go instrumentation project usually take?

Duration depends mainly on fleet size, how many environments are involved, and how quickly approvals come back from security and platform teams. A single cluster with a handful of services moves faster than several clusters spread across separate network zones, where each zone needs its own review of host access and data egress. Teams with a clear inventory of Go services and a named owner for each one usually reach the first working traces sooner. Ask for a timeline that separates a pilot on a few services from the fleet rollout, and that names the dependencies on your side, such as change windows and access requests.

Does eBPF instrumentation need root or elevated privileges on our hosts?

Yes, zero-code eBPF tracing needs elevated privileges on the host or node where the Go processes run, because it attaches probes at the kernel level. Your platform and security teams should decide where those privileges are granted, which nodes are eligible, and how the agent is isolated from workloads. Compile-time instrumentation avoids that host-level access but requires changes to the build pipeline and the code path. Confirm the exact capabilities required against the current OpenTelemetry eBPF Instrumentation documentation before you approve a design.

What do our platform and security teams need to provide?

Plan for named contacts in platform engineering, security, and the team that owns each Go service. Platform engineering provides cluster or host access, node placement rules, network paths to the Collector, and a place to deploy and upgrade the agent. Security reviews the privilege model, the data that will leave each service, redaction rules, and where Collector configuration and credentials are stored. Service owners confirm which operations are business-critical and which attributes must never be exported. Request a written list of these inputs in the scope before work starts, so approvals are not discovered during the rollout.

Can our own team instrument Go services without outside help?

A capable internal team can do it, particularly if it already runs Kubernetes or Linux hosts, maintains Go build pipelines, and has some experience operating a Collector. The work is less about the first trace and more about consistent attributes, safe Collector configuration, privilege reviews, verification of what is deployed, and keeping versions current. Teams that have not run these pieces before often underestimate the review and testing effort. A practical test is whether one engineer can own the design, another can own the Collector, and someone in security can sign off on privileges and redaction. If any of those roles is missing, a fixed-scope engagement can cover the gap while your team keeps the knowledge.

What breaks most often in Go instrumentation projects?

The common failures are privilege requests that arrive late, Collector configurations that export more data than intended, and trace context that stops at service boundaries. Teams also find that manual spans and eBPF spans show up separately unless they are combined through the Auto SDK, which the OpenTelemetry Go zero-code documentation describes. Check log signal maturity before promising log correlation, since the Go docs list logs as a release candidate while traces and metrics are stable. Build verification into the plan, with tests that confirm spans appear, attributes are redacted, and the agent recovers after a node restart.

Which Go signal can we rely on today?

According to the OpenTelemetry Go docs, traces and metrics are stable, and logs are a release candidate. Plan production traces and metrics first, and treat log export as a later phase that needs its own validation. Confirm the current status on the OpenTelemetry Go documentation before you finalize the design, because maturity levels change between releases.

Running Go telemetry after go-live

Once Go services emit telemetry, the recurring work is keeping the SDK and instrumentation libraries current, re-testing after each Go toolchain upgrade, and confirming that traces still join up after every deployment. Assign one owner for the Go telemetry dependencies, pin the OpenTelemetry Go SDK and contrib instrumentation modules in go.mod, and review them on a fixed cadence rather than only when something breaks. The Go docs list traces and metrics as stable and logs as a release candidate, so check the logs signal separately when you upgrade and confirm which signals your services actually depend on before you plan the change. Ask your team to confirm the exact module versions they run in each service.

Treat each Go version upgrade as a telemetry test event. Compile-time instrumentation rewrites code during the build, so rebuild with the new toolchain and confirm the instrumented binary still produces spans for inbound HTTP, gRPC and database calls. For OBI, confirm the eBPF agent still attaches to the new binaries and that the host kernel and agent versions remain supported for your environment, which you should check against the OBI documentation for your platform. Keep a small set of smoke tests that send a known request through each service and assert the expected span names, parent-child links and attributes, and run them in the same pipeline that builds the binary.

Watch the OpenTelemetry Collector release stream, where v0.163.0 was released on October 16, 2026. Read the release notes for component renames, deprecations and changes to the stability level of receivers and processors your pipeline uses, because the Collector's core components have mixed stability levels documented in each component's README. Test new Collector versions in a non-production gateway first. After each deployment, compare trace trees for a sample transaction against the previous release, looking for orphaned spans, missing Auto SDK child spans and changed service names. A dashboard that counts root spans per service makes broken context propagation visible quickly.

How DeployOpen scopes and delivers Go instrumentation

DeployOpen plans, implements and hands over OpenTelemetry instrumentation for Go services inside your own infrastructure. We start by choosing between the Go SDK, OBI, compile-time instrumentation and the Auto SDK for each service, then deliver the work under a written, fixed scope.

How we scope

  • We inventory the Go services, their runtimes, build pipelines and the traces you need before recommending an approach.
  • The written scope names which services use the SDK, OBI or compile-time instrumentation, and which need manual spans.
  • Scope lists the Collector endpoints, backends, environments and acceptance tests, so you can compare quotes on the same basis.

How we build

  • We confirm the Go version and build toolchain each service uses before choosing a compile-time or eBPF path.
  • We wire the Auto SDK and manual spans so eBPF spans and application spans share context in one trace.
  • We test trace propagation, span names, resource attributes and overhead in a staging environment before production rollout.

How we hand over

  • You receive the instrumentation code, build configuration, Collector configuration and deployment manifests in your repositories.
  • Documentation covers the signals in use, each signal's maturity, known gaps and the steps to add a new service.
  • We walk your platform and engineering teams through verification checks, troubleshooting steps and the rollback procedure.

How we support

  • Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.
  • Ongoing support, upgrades of OpenTelemetry components and continuous checks are available as a retainer.
  • Before any upgrade, we review release notes for the Go SDK, OBI and Collector to plan changes to instrumentation.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.