Reference libraries
Each library implements the libo11y design contract in its language's own idiom. After one setup call, application code uses the standard OpenTelemetry API and the language's own logging interface.
The parity matrix tracks every capability of the design contract. It has a Go column today and gains a column as each language starts. Parity means that the capability exists in the language's own idiom. The APIs may differ.
Go
Go is released at go/v0.2.0. The main module holds setup and the net/http and gRPC middleware. Gin, Connect and database/sql each have their own module, released beside the main module at the same version, so an application downloads only the integrations it imports.
| Module | Tag | Contains |
|---|---|---|
go | go/v0.2.0 | Setup and the SDK handle, o11yhttp, o11ygrpc, o11yproc, redact, the o11ytest harness and the generated spec package |
o11ygin | go/o11ygin/v0.2.0 | Gin middleware |
o11yconnect | go/o11yconnect/v0.2.0 | Connect RPC server and client interceptors over otelconnect |
o11ysql | go/o11ysql/v0.2.0 | database/sql client spans and metrics, libo11y's own connector wrapper |
go get github.com/jamesainslie/libo11y/go@v0.2.0
go get github.com/jamesainslie/libo11y/go/o11ygin@v0.2.0 # only for Gin
go get github.com/jamesainslie/libo11y/go/o11yconnect@v0.2.0 # only for Connect
go get github.com/jamesainslie/libo11y/go/o11ysql@v0.2.0 # only for database/sqlThe modules require Go 1.26.0 or later. Build with go1.26.9 or later on the 1.26 line, or go1.27.2 or later on the 1.27 line, to pick up the standard-library security fixes.
package main
import (
"context"
"log"
"log/slog"
"go.opentelemetry.io/otel"
o11y "github.com/jamesainslie/libo11y/go"
"github.com/jamesainslie/libo11y/go/spec"
)
func main() {
ctx := context.Background()
sdk, err := o11y.Setup(ctx,
o11y.WithServiceName("checkout"),
o11y.WithEnvironment(spec.EnvironmentProduction),
)
if err != nil {
log.Fatal(err)
}
defer sdk.Shutdown(context.Background())
// Vanilla OTEL and log/slog from here on.
ctx, span := otel.Tracer("checkout").Start(ctx, "startup")
defer span.End()
slog.InfoContext(ctx, "ready") // correlated with the span, exported
}A deployment environment is required. Set it with WithEnvironment or with OTEL_RESOURCE_ATTRIBUTES=deployment.environment.name=production. The option wins over the variable. The allowed values are production, staging, development and test, and WithEnvironmentValues extends them.
The Go README has the full Go documentation.
TypeScript
TypeScript is in development. The registry generates the package @libo11y/spec in ts/packages/spec. It holds the attribute keys, enums, event and metric names, and the sensitivity tables. It is not published to npm yet.
Rust, Java and Zig
Rust, Java and Zig are planned and not started. When each one starts, the parity matrix tracks it against the same baseline, with its own idiom column.
Versioning
Each library versions and releases on its own, with path-prefixed tags such as go/v0.2.0. Languages do not release in lockstep. From go/v0.2.0, each Go release also tags go/o11ygin, go/o11yconnect and go/o11ysql at the same version on the same commit.
The specification has its own version, currently 1.2.0, and its own schema URL. The schemas page lists every published version.