OpenTelemetry in Go — SDK setup, API surface, breaking changes, contrib instrumentation libraries (otelhttp, otelgrpc, otelmongo), compile-time zero-code instrumentation (otelc), and performance tuning. Use when adding, reviewing, or configuring OpenTelemetry in a Go service. Triggers on "setup otel in go", "go telemetry", "go tracing", "otelconf go", "otelhttp", "otelgrpc", "TracerProvider go", "MeterProvider go", "otelc", "compile-time instrumentation go", "zero-code go instrumentation", "go …
Zero-code, compile-time instrumentation with otelc: usage modes (otelc go build, tool dependency, toolexec drop-in), subcommands, supported libraries, rule sources/precedence, and pinning via otel.instrumentation.go.
For upgrade reviews, always finish with a safe local verification path (go mod tidy -diff, go build ./..., and go test ./...). Test exporter URL or retry changes against a disposable local receiver, never a deployment endpoint.
Module versioning — read before adding dependencies
opentelemetry-go is split into independently versioned module groups. They do NOT share one version number. Assuming they do is the most common cause of broken builds and version churn:
The trap: pinning every module to the core version (e.g. go get go.opentelemetry.io/otel/[email protected]) fails — log and bridge modules have no v1.x tag. Hand-picking and re-guessing each @vX is the churn to avoid.
Do this instead — add each module with @latest and let Go resolve a compatible set:
go get go.opentelemetry.io/otel@latest go.opentelemetry.io/otel/sdk@latest
# logs (separate v0.x line — do NOT force the core version):
go get go.opentelemetry.io/otel/log@latest go.opentelemetry.io/otel/sdk/log@latest \
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp@latest
# contrib (instrumentation and bridges each resolve to their own v0.x line):
go get go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp@latest \
go.opentelemetry.io/contrib/bridges/otelslog@latest
go mod tidy && go build ./...
If exact versions are required, fetch each module group's tag from its own source (see below) — never infer one group's version from another's.
Sources of Truth
For YAML schema details, fetch the upstream sources listed in the otel-declarative-config skill. For Go-specific facts:
Fact
Fetch
Latest go.opentelemetry.io/otel core release
gh api repos/open-telemetry/opentelemetry-go/releases/latest -q '.tag_name'
Latest go.opentelemetry.io/contrib release
gh api repos/open-telemetry/opentelemetry-go-contrib/releases/latest -q '.tag_name'
Latest otelconf module tag
gh api repos/open-telemetry/opentelemetry-go-contrib/git/matching-refs/tags/otelconf -q '.[-1].ref'
Latest Go semconv package
Search the selected core release's CHANGELOG for Add the go.opentelemetry.io/otel/semconv/; do not infer package availability from the upstream semantic-conventions release.