OpenTelemetry Weaver registry authoring, codegen, and CI enforcement. Use when adopting Weaver, authoring or reviewing a registry (manifest, attributes, metrics, spans, events), writing Jinja2 templates against the resolved schema, migrating hand-maintained telemetry constants, or wiring `weaver registry check`/`generate`/`diff` into CI.
Installation
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
OpenTelemetry Weaver registry authoring, codegen, and CI enforcement. Use when adopting Weaver, authoring or reviewing a registry (manifest, attributes, metrics, spans, events), writing Jinja2 templates against the resolved schema, migrating hand-maintained telemetry constants, or wiring `weaver registry check`/`generate`/`diff` into CI.
OpenTelemetry Weaver
Use this skill when an organization wants to define its own semantic conventions on top of upstream OTel and generate language bindings from them.
Usage:
pair with otel-semantic-conventions to decide which attributes already exist upstream and should not be redeclared in the local registry
do not rely on memory alone when the guidance can be checked from official sources
consult the Weaver repo, schemas/semconv-syntax.v2.md, and docs/usage.md / docs/validate.md
state which fallback you used and leave any unverified item unresolved
Mental Model
Three moving parts:
Registry — directory of YAML files. manifest.yaml is required; its schema_url (OTel schema URL format, http[s]://host/path/<version>) both names the registry and carries its version in the final path segment. Dependency entries also use schema_url plus optional registry_path. The rest declare attributes, metrics, spans, events, entities. The version segment of schema_url is yours to manage; bump it on changes. (name, semconv_version, and schema_base_url are legacy/deprecated in favor of schema_url.)
Templates — directory of Jinja2 files plus a weaver.yaml per target language describing which templates to run, with what filter, in what application_mode, and with what output filename.
Policies — Rego rules. Built-in OTel policies are the floor; custom policies layer on org rules.
These three replace a hand-rolled const.go (or equivalent): const blocks become the registry, the act of writing them becomes codegen, and tribal knowledge becomes policies.
Non-Negotiable Rules
Install Weaver via one of the methods documented at https://github.com/open-telemetry/weaver#install (release binary, otel/weaver:vX.Y.Z Docker image, or the setup-weaver GitHub Action). Never brew install weaver — that resolves to an unrelated Scribd tool.
Reference upstream semconv attributes by ref rather than redeclaring them. Boundary domains (http, db, messaging, rpc, network, gen-ai, ...) belong in upstream OTel semconv, not in a local registry. Use the language SDK's semconv package for those at runtime.
Every entry needs stability. Weaver refuses to generate without it.
Use a domain prefix (e.g. ecommerce., acme.) for org-local attributes, metrics, and spans.
Run the language formatter (gofmt -w, prettier, ruff format, ...) on generated output. Jinja whitespace produces multiple blank lines; without formatting, the diff check in CI will fail spuriously.
Confirm the resolved schema shape before writing a template. For a definition/2 registry, call the grouped jq helpers with {"v2": true}; the v2 template ctx preserves fields such as attribute key, metric name, span type/kind, and structured span.name.note. See references/template-authoring.md for how to dump the exact shape.
Workflow
Install or locate Weaver. Follow the upstream install instructions at https://github.com/open-telemetry/weaver#install — pick a pinned release binary, the otel/weaver:vX.Y.Z Docker image, or the setup-weaver GitHub Action. Use Docker for CI and reproducible local runs.
Author the registry. Required: manifest.yaml plus at least one of attributes.yaml / metrics.yaml / spans.yaml / events.yaml. See references/registry-authoring.md.
Author templates. One target dir per language under templates/registry/<lang>/ with weaver.yaml plus *.j2. See references/template-authoring.md.
Validate and generate.weaver registry check --v2 -r ./telemetry/registry/ for fast feedback. weaver registry generate --v2 --registry ./telemetry/registry/ --templates ./telemetry/templates/ <lang> <output-dir> for codegen. Run the language formatter on the output.
Wire into CI. Three gates: check (schema), generate + git diff --exit-code (checked-in code is current), diff against the base branch (surfaces breaking changes). See references/ci-integration.md.
Gotchas
These cost time and are not obvious from the upstream docs:
brew install weaver installs the wrong tool. Use GitHub releases or Docker.
Generated output is not formatter-clean. Always run the language formatter after weaver registry generate.
Jq helper defaults target the legacy schema. For definition/2, pass {"v2": true} and use the preserved v2 fields: attribute key, metric name, span type/kind, and span.name.note. Always generate and inspect the filtered ctx before writing a template.
The comment Jinja filter takes a keyword argument: attr.brief | comment(format="go"). It already emits the // prefix; do not add another.
Spans and events have prebuilt grouped jq filters — semconv_grouped_spans and semconv_grouped_events — alongside semconv_grouped_attributes and semconv_grouped_metrics. For definition/2, use (for example) semconv_grouped_spans({"v2": true}) as a folded YAML scalar; the bare helper defaults select the legacy schema.
weaver registry check emits "File format definition/2 is not yet stable" (a warning) on every run as of 0.24.2. This is normal; do not treat it as a failure.
--future is opt-in but breaks today on definition/2. Note this in CI guidance and re-enable once the format goes stable.
CLI argument ordering for generate: target directory name is positional after--registry and --templates; the output directory follows. --templates points at the parent that contains target dirs, not at the language-specific subdir.
Span name in registry vs. runtime: required schema fields are type, kind (client/server/producer/consumer/internal), brief, stability, and a structured name: { note: "..." }. For internal business spans, putting the dotted type identifier in name.note and rendering the resolved span.name.note string at runtime is clean.
What does NOT belong in your local registry. DB, HTTP, messaging, RPC, network, GenAI, and similar boundary spans/attributes follow upstream OTel semconv. Until upstream is pulled in as a manifest dependency, instrumentation for those should reference the language SDK's semconv package directly. This is the most common modeling mistake.
Drop the .total suffix from counter names — OTel naming has moved away from it.
Use seconds (s) for duration histograms, not milliseconds. Migrating from ms is a natural step when authoring the schema; flag it.
References To Load On Demand
registry YAML field reference: references/registry-authoring.md