o11y.ing
spec 1.2.0

    GitHub
    spec 1.2.0docs/CONVENTIONS.md

    libo11y conventions

    On this page
    text
    libo11y/
      docs/          cross-language design contract, spec, and conventions
      spec/          telemetry specification registry: the shared,
                     language-neutral source of truth
      go/            Go modules (github.com/jamesainslie/libo11y/go and the
                     o11ygin, o11yconnect, and o11ysql submodules)
      ts/            TypeScript workspace: Bun, the @libo11y/* packages
      rust/          Rust workspace (planned)
      java/          Java/Maven module (planned)
      zig/           Zig package (planned)

    Each language directory is self-contained: its own build, tests, lint configuration, changelog, and README. The spec/ registry is the shared, language-neutral source of truth; each language generates typed constants and validation tables from it.

    The specification is validated and generated by the repository’s own Go tool (go/internal/specgen); the toolchain needs nothing beyond the Go module itself. Make targets from the repository root:

    • make spec-check decodes the registry strictly and validates it against the libo11y policy suite: naming, namespace ownership, sensitivity and cardinality classification, references and tombstones, enums, event discipline, and metric naming/unit rules. Rule IDs are listed in SPEC.md, section 8.
    • make spec-generate validates first, then regenerates go/spec, go/internal/spectables, docs/taxonomy, ts/packages/spec/src/generated, and the OpenTelemetry schema files under spec/schemas from the registry. An invalid registry generates nothing. Generated files are never edited by hand.
    • make spec-drift fails if generated artifacts are stale or if the generator produced files git does not track. CI runs it, and a golden test in go test catches the same drift.

    The upstream semantic-conventions release the registry extends is pinned as semconv_version in spec/registry/manifest.yaml; referenced upstream attributes are defined by that release and never redefined here.

    The TypeScript workspace in ts/ pins its toolchain exactly. It uses bun@1.3.13 as the package manager and runtime, typescript@7.0.2, @biomejs/biome@2.6.8 for linting and formatting, and @types/bun@1.4.4. make ts-check installs the locked dependencies, then lints, typechecks and tests every package. make ci runs it.

    • Independent per-language versioning, path-prefixed tags: go/v0.1.0, rust/v0.1.0.
    • Semantic versioning per language ecosystem norms.
    • No lockstep releases across languages. A change to shared docs never forces a release.
    • Each language keeps a CHANGELOG.md in Keep a Changelog format.
    • The Go family is four modules: github.com/jamesainslie/libo11y/go and the submodules go/o11ygin, go/o11yconnect and go/o11ysql. They release together at one version. A release tags go/vX.Y.Z first, then go/o11ygin/vX.Y.Z, go/o11yconnect/vX.Y.Z and go/o11ysql/vX.Y.Z, all on the same commit, and each submodule’s go.mod requires the parent at that version. make release-check validates the sequence for RELEASE_VERSION (default v0.2.0) against a throwaway local remote; it never touches real refs. The default always matches the version the submodules require, so it moves only in a release commit.
    • To release Go version X.Y.Z: move the changelog’s entries into a ## [X.Y.Z] - date section, set each submodule’s requirement on the parent module to vX.Y.Z, set RELEASE_VERSION in the Makefile and the default in scripts/release-check.sh to vX.Y.Z, and run make release-check on the commit to release. Then push the tags, all on that commit, in two pushes: go/vX.Y.Z on its own, then the three submodule tags. Never push all four together, because GitHub creates no push events when more than three tags are pushed at once. Each tag starts the release workflow (.github/workflows/release.yml). It checks that the version is semantic, that a submodule tag’s parent tag exists on the same commit and matches its go.mod requirement, and that the changelog has the section, then runs vet, the tests, and the spec gates. It publishes a GitHub Release whose notes are that changelog section (scripts/release-notes.sh, reading go/CHANGELOG.md, which covers all four modules), marked as a prerelease only for versions with a -prerelease suffix, and requests the version from proxy.golang.org and builds a consumer against it.
    • TypeScript releases are lockstep. Every @libo11y/* package publishes at one shared version from a ts/vX.Y.Z tag, starting with ts/v0.1.0. Until then @libo11y/spec is private at version 0.0.0, and nothing publishes it.
    • The specification versions separately: once released, each version has a spec/vX.Y.Z tag and a schema file served at its schema URL. Spec 1.0.0 is tagged spec/v1.0.0 on the go/v0.1.0 commit. Before tagging, make schema-published confirms the schema URL serves the generated file byte for byte. See SPEC.md, section 7.
    • The user-facing package/crate/artifact is named o11y where the ecosystem allows (Go package o11y, Rust crate libo11y, Java artifact libo11y).
    • Metric and attribute names emitted on behalf of applications come from OpenTelemetry semantic conventions at the pinned version, with no vendor prefix. The library’s own telemetry (the o11y.schema.violations metric, registered events, o11y.config.* startup attributes) uses the o11y.* namespace, which only the spec registry may mint.
    • The semconv pin is recorded per language release and upgraded deliberately. Current pin: semconv v1.41.0.

    Standard OTEL_* variables are the only environment surface. libo11y defines no LIBO11Y_* variables for anything OTEL specifies. If a knob has no OTEL equivalent it is a code-level option, not an environment variable, until the OTEL specification catches up.

    <area>: <type>: <description> all lowercase, where area is one of go, ts, spec, rust, java, zig, docs, general, and type follows Conventional Commits (feat, fix, docs, refactor, test, chore, build, ci, perf, revert) or names a Keep a Changelog category (change, removed).

    Example: go: feat: add o11ytest recorder harness

    make ci runs every gate locally, and .github/workflows/ci.yml runs the same gates on pushes to main and on pull requests (Go 1.26.x, split into parallel jobs). Every CI job calls the Makefile target except lint, which runs the same golangci-lint version (v2.12.2) through golangci/golangci-lint-action on each module. Keep the two in step when adding a gate.

    Target Gate
    make lint golangci-lint v2 (with gofumpt) on every Go module, zero issues; golangci-lint fmt applies the formatter
    make vet go vet on every Go module
    make test go test -race on every Go module (GO_TEST_P sets package parallelism), including the testing/slogtest handler contract, the OTLP wire tests, and the generator’s golden test
    make tidy-check each module’s go.mod and go.sum tidy on its own (GOWORK=off)
    make spec-check, make spec-drift registry policy checks and generated-artifact drift
    make release-check the Go release sequence (needs a clean tree)
    make vuln govulncheck on every Go module; runs last because it depends on the advisory database and the toolchain’s patch level
    • Go: the gates above. Standard-library advisories are fixed by the toolchain, not the module: build with go1.26.9 or later on the 1.26 line (or go1.27.2 or later on the 1.27 line), or make vuln reports them.
    • Rust (planned): clippy pedantic, unsafe_code = "forbid", cargo-deny.
    • Java (planned): errorprone, spotless.
    • Zig (planned): zig fmt, exhaustive switch on error sets.

    Source: docs/CONVENTIONS.md at 23fbb21