otel-weaver
Skill126 starsChanged 4 months agoApache-2.0View on GitHub
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, wiring `weaver registry check`/`generate`/`diff` into CI, or choosing a Weaver version for a semantic-conventions release.
- Installs packages
In this repository19 other files it gives its agents.
- AGENTS.mdAGENTS.md
- otel-browserSkill
- otel-collector-builderSkill
- otel-collectorSkill
- otel-declarative-configSkill
- otel-dotnetSkill
- otel-goSkill
- otel-javaSkill
- otel-jsSkill
- otel-ottlSkill
- otel-profilesSkill
- otel-pythonSkill
- otel-rubySkill
- otel-sdk-versionsSkill
- otel-semantic-conventionsSkill
- otel-span-events-to-logs-migrationSkill
- otel-telemetry-emissionsSkill
- otel-telemetrygenSkill
- otel-upgradeSkill
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 4 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Use this skill when an organization wants to define its own semantic conventions on top of upstream OTel and generate language bindings …
- Distinctive: line 14
If a companion skill is unavailable:
- Distinctive: line 16
do not rely on memory alone when the guidance can be checked from official sources
- Very specific: line 34
Every attribute and signal definition needs stability.
- Very specific: line 36
Use a domain prefix (e.g. ecommerce., acme.) for org-local attributes, metrics, and spans.
- Very specific: line 37
Run the language formatter (gofmt -w, prettier, ruff format, ...) on generated output.
- Very specific: line 42
Install or locate Weaver: Follow the upstream install instructions at <https://github.com/open-telemetry/weaver#install> — pick a pinned …
- Distinctive: line 88
If you authored or modified a Weaver registry, templates, or CI integration:
- Very specific: line 90
run weaver registry check --v2 against the definition/2 registry and capture the result
- Very specific: line 91
run weaver registry generate --v2 and the language formatter, then verify git diff --exit-code is clean
- Very specific: line 101
every definition and enum member has stability
- Very specific: line 103
no boundary-domain (http/db/messaging/rpc/network/gen-ai) entries duplicated locally
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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-conventionsto decide which attributes already exist upstream and should not be redeclared in the local registry - latest Weaver version: the
otel-sdk-versionsindex if it lists Weaver, else https://github.com/open-telemetry/weaver/releases;references/ci-integration.mdkeeps a dated Weaver/semconv compatibility record for offline answers
If a companion skill is unavailable:
- do not stop
- do not rely on memory alone when the guidance can be checked from official sources
- consult the Weaver repo,
schemas/semconv-syntax.v2.md, anddocs/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.yamlis required; it declaresfile_format: definition_manifest/2.0(version support: dated record), and itsschema_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 requireschema_urlplus optionalregistry_path. The rest declareattributes,metrics,spans,events,entities. The version segment ofschema_urlis yours to manage; bump it on changes. (semconv_versionandschema_base_urlare deprecated in favor ofschema_url; top-levelnameis not a v0.28.0 manifest field.) - Templates — directory of MiniJinja files (Jinja2-compatible, not full Jinja2 — auto-escaping is off by default since v0.22.0 and loop
break/continueare supported) plus aweaver.yamlper target language describing which templates to run, with what filter, in whatapplication_mode, and with what output filename. - Policies — Rego rules evaluated by the Regorus (OPA-compatible) engine, in four packages:
before_resolution(raw parsed groups; unsupported and skipped with--v2),after_resolution(resolved registry),comparison_after_resolution(only when--baseline-registryis passed), andlive_check_advice(per-sample duringlive-check). 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.ZDocker image, or thesetup-weaverGitHub Action). Neverbrew install weaver— that resolves to an unrelated Scribd tool. - Reference upstream semconv attributes by
refrather 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 attribute and signal definition needs
stability; include it on enum members too —weaver registry checkdoes not catch a missing one (see registry-authoring.md). - In v2, an attribute reference may refine fields such as
brief,note,examples, andannotations, but notstabilityordeprecated; those always come from the attribute definition. - 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/2registry, call the grouped jq helpers with{"v2": true}; the v2 templatectxpreserves fields such as attributekey, metricname, spantype/kindand structuredspan.name.note, plus entitytype/identity/description. Seereferences/template-authoring.mdfor 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.ZDocker image, or thesetup-weaverGitHub Action. Use Docker for CI and reproducible local runs. - Author the registry. Required:
manifest.yamlplus one or moredefinition/2YAML files declaring attributes, attribute groups, metrics, spans, events, or entities. Seereferences/registry-authoring.md. - Author templates. One target dir per language under
templates/registry/<lang>/withweaver.yamlplus*.j2. Seereferences/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),diffagainst the base branch (surfaces breaking changes). Seereferences/ci-integration.md.
The Weaver CLI has more subcommands than this workflow touches: stats and json-schema for quick registry sanity checks, update-markdown for keeping semconv snippets in docs current, emit/live-check/infer for working against live OTLP telemetry, package for writing a self-contained resolved registry artifact (the replacement for the deprecated resolve), mcp for exposing a registry to LLM tooling, and serve for an HTTP+UI mode. All are out of scope here (see below) but worth knowing exist before assuming check/generate/diff is the whole surface.
Gotchas
These cost time and are not obvious from the upstream docs:
brew install weaverinstalls 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: attributekey, metricname, spantype/kindandspan.name.note, plus entitytype/identity/description. Always generate and inspect the filteredctxbefore writing a template. - The
commentJinja filter takes a keyword argument:attr.brief | comment(format="go"). It already emits the//prefix; do not add another. - Attributes, metrics, spans, events, and entities all have prebuilt grouped jq filters (
semconv_grouped_attributes,semconv_grouped_metrics,semconv_grouped_spans,semconv_grouped_events,semconv_grouped_entities). Fordefinition/2, use (for example)semconv_grouped_spans({"v2": true})as a folded YAML scalar; the bare helper defaults select the legacy schema. weaver registry checkemits "File formatdefinition/2is not yet stable" (a warning) for custom v2 definition files (still so in the dated record inreferences/ci-integration.md). This is normal; do not treat it as a failure. A missing manifestfile_formatalso warns; fix that one by adding the field.--futureis opt-in but still elevates thedefinition/2instability warning (and a missing manifestfile_format) to an error for a custom v2 registry. Leave it off until the format goes stable.- CLI argument ordering for
generate: target directory name is positional after--registryand--templates; the output directory follows.--templatespoints 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 structuredname: { note: "..." }. For internal business spans, putting the dotted type identifier inname.noteand rendering the resolvedspan.name.notestring 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.
- Counter and UpDownCounter names should not append
_total; this is the semconv v1.44.0 naming rule. - Duration instruments should use seconds (
s) under the semconv v1.44.0 unit guidance.
References To Load On Demand
- registry YAML field reference:
references/registry-authoring.md - Jinja2 patterns, jq filters, resolved-shape cheat sheet:
references/template-authoring.md - ready-to-lift GitHub Actions example and the dated version-compatibility record:
references/ci-integration.md - hand-maintained-constants → registry walkthrough:
references/migration-playbook.md - semantic conventions skill:
otel-semantic-conventions - manual instrumentation skill:
manual-instrumentation
Out Of Scope
These are natural follow-ups but not part of this skill:
- publishing the registry as a versioned artifact for downstream consumers (
weaver registry package) - declaring upstream semantic-conventions as a manifest dependency
weaver registry live-check/emit/inferagainst live OTLP telemetryweaver registry mcp/weaver serve- custom Rego policies beyond the built-ins
- helper-function codegen (
MyMetricName(meter)wrappers)
Verification Contract
If you authored or modified a Weaver registry, templates, or CI integration:
- re-open the changed files before finishing
- run
weaver registry check --v2against thedefinition/2registry and capture the result - run
weaver registry generate --v2and the language formatter, then verifygit diff --exit-codeis clean - confirm each applicable item with codebase evidence
Report the final check with:
[x]completed[~]not applicable, with a reason[ ]unresolved
Use these items:
- registry has
manifest.yamlwithfile_format: definition_manifest/2.0and aschema_urlwhose final path segment is the version - every definition and enum member has
stability - org-local attributes/metrics/spans use a domain prefix
- no boundary-domain (http/db/messaging/rpc/network/gen-ai) entries duplicated locally
- Counter and UpDownCounter names have no
_totalsuffix - duration histograms use
s(seconds) - templates use jq filters that match the resolved schema (for
definition/2, call the prebuiltsemconv_grouped_*helpers with{"v2": true}) - generated output is formatter-clean
- CI runs
check,generate+git diff --exit-code, anddiffagainst the base branch - changed files were re-read
- remaining risks or gaps are stated
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

