Mechanics reference for the OpenTelemetry Go API, SDK, and instrumentation libraries.
Current Versions
| Component | Version | Notes |
|---|---|---|
SDK (go.opentelemetry.io/otel) |
v1.42.0 | Requires Go 1.25+ |
Contrib (go.opentelemetry.io/contrib) |
v1.42.0 | Matches SDK version |
| Semconv package | go.opentelemetry.io/otel/semconv/v1.40.0 |
Latest available |
Gotchas and Breaking Changes
span.RecordError()andspan.AddEvent()are deprecated. Use the Logs API to emit events and record exceptions within the context of the active span.go.opentelemetry.io/contrib/configis deprecated (contrib v1.35.0). Usego.opentelemetry.io/contrib/otelconf/v0.3.0instead. The API is identical.- Current SDK version: v1.42.0 (requires Go 1.25+). Current semconv package:
go.opentelemetry.io/otel/semconv/v1.40.0. - otelhttp removed
DefaultClient,Get,Head,Post,PostForm,WithPublicEndpoint,WithRouteTagin contrib v1.40.0. Always create a custom client withotelhttp.NewTransport. - RPC semantic convention renames in contrib v1.40.0+:
rpc.system->rpc.system.name;rpc.method+rpc.servicemerged intorpc.method;rpc.client.duration/rpc.server.duration->rpc.client.call.duration/rpc.server.call.duration(unit changed to seconds);rpc.grpc.status_code->rpc.response.status_code. - otelgrpc in contrib v1.42.0: no longer emits
rpc.messagespan events,rpc.*.request/response.sizemetrics, ornetwork.*attributes. Even withWithMessageEvents. - HTTP instrumentation (contrib v1.40.0+) sets
error.typeattribute instead ofexceptionspan events. - otelgrpc: prefer stats handlers (
NewServerHandler/NewClientHandler) over deprecated interceptors for new code. trace.SpanFromContext()never returns nil — no nil checks orIsRecording()guards needed.- Propagator must be set manually via
otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{}))until contrib issue #6712 is resolved. WithMetricAttributesFndeprecated in otelhttp (contrib v1.41.0). UseLabelerinstead.log.Record.SetErr(err)(v1.42.0) — the SDK automatically setsexception.typeandexception.messageattributes.
References
Load these on demand based on the task:
- Setting up the SDK, configuring providers, or initializing telemetry? Read
references/sdk-setup.md. - Using the tracing, metrics, or logs API? Read
references/api.md. - Adding or configuring instrumentation libraries (otelhttp, otelgrpc, otelgin, otelsql, logging bridges)? Read
references/instrumentation-libraries.md. - Tuning batch sizes, sampling, cardinality limits, or export intervals? Read
references/performance.md. - Using file-based YAML configuration for the SDK? Use the
opentelemetry-sdk-configurationskill for the schema, then seereferences/sdk-setup.mdfor Go-specific loading viaotelconf.