o11y.ing
spec 1.2.0

    GitHub
    OpenTelemetry specification v1.2.0

    One telemetry contract for every service.

    libo11y specifies the resource attributes, logs, spans, metrics and events a service emits, and how sensitive each attribute is. Reference libraries apply it in one setup call, on plain OpenTelemetry.

    $ go get github.com/jamesainslie/libo11y/go@v0.2.0

    An example request: one trace, its log records and a metric exemplar share the trace ID 4bf92f3577b34da6.

    One trace ID in the span, the log records and the metric exemplar
    spec version
    1.2.0
    attributes defined
    33
    metrics
    10
    events
    7
    span shapes
    5
    semconv pinned
    1.41.0
    01What the spec defines

    The parts OpenTelemetry leaves to you.

    OpenTelemetry standardises the wire format and the common attributes. libo11y adds the house rules a team writes down sooner or later, as a versioned registry that code is generated from.

    Resource taxonomy

    Four tiers, from the identity a service must resolve before telemetry starts to opt-in tenancy, plus the keys that are forbidden by default.

    Sensitivity classification

    Every attribute is labelled public, internal, pii or secret. Each library redacts by that label, and the label is generated into every language from one registry.

    o11y.telemetry.configured
    o11y.request.summary
    o11y.telemetry.dropped
    o11y.rum.error

    Event catalog

    Named events with the attributes each one requires, so a summary record means the same thing in every service.

    go spec.TenantIDKey
    ts ATTR_TENANT_ID
    enums · tables · checks

    Generated code

    The registry generates typed keys, closed enums and the validation tables the runtime and test harness share.

    02Principles

    Six rules the libraries keep.

    Each one is a property you can check. The bundled test harness asserts them in your own test suite.

    01

    Pure OpenTelemetry

    OTLP for all three signals. Standard OTEL_* variables are honoured and never shadowed.

    02

    One identity, three surfaces

    Logs, spans and outgoing headers read the active span context. There is no second copy of the trace ID.

    03

    Wrap setup, not instrumentation

    One call wires the providers. After that you use the vanilla OTEL API and your language's own logger.

    04

    Owned lifecycle

    Setup returns a handle with a bounded, idempotent Shutdown. The library never panics and never blocks startup on a collector.

    05

    Locally testable

    A hermetic harness records every signal in memory and asserts conformance, with no global state touched.

    06

    Safe in the dark

    With no configuration at all the application runs normally, and telemetry degrades instead of crashing the host.

    03Reference libraries

    The spec, applied in one call.

    Each library implements the same design contract in its language's own idiom. Go is released. TypeScript is in development.

    Go
    go/v0.2.0 · net/http, gin, grpc, connect, database/sql
    released
    TypeScript
    @libo11y/spec generated
    in development
    Rust
    not started
    planned
    Java
    not started
    planned
    Zig
    not started
    planned
    main.go
    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
    }
    Schema URL
    https://schemas.o11y.ing/libo11y/1.2.0

    Every resource the libraries build carries this URL. Each published version is immutable, so tools can translate telemetry between spec versions.

    How versions work →