mcpField
O
otel-semantic-conventions

otel-semantic-conventions

github.com/dash0hqCloud & DevOps98705 installsUpdated 1w ago
Repository

About otel-semantic-conventions

otel-semantic-conventions is a skill for selecting, placing, and validating telemetry attributes and metrics against OpenTelemetry Semantic Conventions. It is for developers writing or reviewing telemetry, with guidance on the attribute registry, versioning, and Dash0-derived attributes.

Key features

  1. 01Select standard attributes from the registry
  2. 02Distinguish resource and span attributes
  3. 03Check attribute stability and cardinality
  4. 04Guide semantic convention version migrations
  5. 05Explain Dash0-derived attributes

Use cases

  1. 01Review HTTP, database, or RPC attributes
  2. 02Choose between resource and span placement
  3. 03Avoid high-cardinality metric attributes
  4. 04Migrate semantic convention versions

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/dash0hq/agent-skills --skill otel-semantic-conventions

After installing, type/otel-semantic-conventionsin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

rules/
attributes.md
dash0.md
versioning.md

Details

From the project README

OpenTelemetry Semantic Conventions

This skill governs correct selection, placement, and validation of telemetry attributes and metric instruments according to the OpenTelemetry Semantic Conventions specification. For span naming, span kinds, and span status codes, see the otel-instrumentation skill.

The Attribute Registry is the single source of truth for all defined attributes.

Rules

RuleDescriptionUse Case
attributesAttribute registry, selection, placement, common attributes by domainChoosing or reviewing attributes; HTTP/DB/messaging/RPC attributes; attribute placement (resource vs span)
versioningSemconv versioning, stability, migrationSemconv version migration
dash0Dash0 derived attributes and feature dependenciesDash0 derived attributes

Official documentation

How to select the right attribute

  1. Search the registry first — Look up the concept in the Attribute Registry. Use the standard name if it exists (e.g., prefer http.request.method over a custom custom.http.verb). Custom names fragment querying and break tooling — only create a custom attribute when no registry entry covers the concept.
  2. Check stability — Prefer stable attributes; note any experimental attributes that may change. See versioning.
  3. Place at the correct level — Resource attributes describe the entity producing telemetry; span/log attributes describe the individual operation. Do not duplicate across levels. Once an attribute is at a given level, keep it there consistently across all services.
  4. Verify cardinality — Metric attribute values must be low-cardinality (bounded set). Variable data (user IDs, request paths with parameters) belongs in span attributes, not metric attributes.
  5. Custom attribute as last resort — Only create a custom attribute if no registry entry covers the concept. Document the decision and follow the org.namespace.attribute_name naming pattern.
Example: correct vs incorrect attribute selection
# Correct — uses registry attribute for HTTP method
span.set_attribute("http.request.method", "GET")

# Incorrect — invents a custom attribute for a concept already in the registry
span.set_attribute("custom.http.verb", "GET")
Example: resource vs span attribute placement
# Correct — service identity is a resource attribute
resource = Resource({"service.name": "checkout-service", "service.version": "2.1.0"})

# Correct — operation-specific data is a span attribute
span.set_attribute("http.request.method", "POST")
span.set_attribute("http.response.status_code", 201)

# Incorrect — placing a resource-level attribute on every span
span.set_attribute("service.name", "checkout-service")  # belongs on the resource
Example: cardinality violation in metric attributes
# Correct — metric attribute uses a bounded, low-cardinality value
histogram.record(duration_ms, {"http.request.method": "GET", "http.response.status_code": 200})

# Incorrect — unbounded values as metric attributes explode storage and query cost
histogram.record(duration_ms, {"user.id": "u-839201", "url.path": "/orders/839201"})
# Fix: move high-cardinality values to span attributes instead
span.set_attribute("user.id", "u-839201")
span.set_attribute("url.path", "/orders/839201")

Comments

Markdown supported