agentleFS
ScaleDockHQScaleDockHQ/scaledock-skills/skills/opentelemetry-genai/SKILL.md

opentelemetry-genai

Skill1 starsChanged 31 days agoMITView on GitHub

OpenTelemetry GenAI semantic conventions: instrument LLM inference, embeddings, tool calls and agents with gen_ai.* spans, attributes, events and metrics. Use when tracing calls to a model provider, adding telemetry to an agent or tool loop, recording token usage and latency, deciding whether to capture prompts and completions, instrumenting MCP clients or servers, or moving an instrumentation to the latest experimental conventions with OTEL_SEMCONV_STABILITY_OPT_IN. Triggers: OpenTelemetry, OTel, semantic conventions, semconv, GenAI, LLM observability, gen_ai.operation.name, gen_ai.provider.name, gen_ai.request.model, gen_ai.usage.input_tokens, gen_ai.input.messages, invoke_agent, execute_tool, create_agent, gen_ai.client.operation.duration, gen_ai.client.inference.usage, gen_ai_latest_experimental, mcp.method.name.

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Token counts report billable tokens: when a system reports both used and billable tokens, and the per-operation histograms are never used …

    line 34
  2. Very specific:

    Decide on content capture: Default off; if enabled, choose span attributes or external storage, and apply truncation.

    line 44

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

OpenTelemetry GenAI semantic conventions

The OpenTelemetry semantic conventions for generative AI define the span names, span kinds, gen_ai.* attributes, events and metrics for model inference, embeddings, tool execution, agents and the Model Context Protocol. They are maintained in the open-telemetry/semantic-conventions-genai repository and have Development status. With this skill the agent instruments GenAI calls so that any OpenTelemetry backend can read them.

Follow the workflow below step by step. Every rule here comes from a source in Sources, with the section it cites. When a rule and the pinned source disagree, the source wins; when the source has a newer revision than the pin, follow the refresh steps.

Inputs (fill in, or ask before starting)

  • Role: instrumentation author (library or framework), application developer adding manual spans, or backend consumer reading the data.
  • Revision: Draft posture: build. The pin is commit b31e9e8ea26ac1c086d3313d474e31d7c3f391ae (2026-09-30) of semantic-conventions-genai, schema URL https://opentelemetry.io/schemas/gen-ai-dev/1.42.0-dev, built on semantic conventions v1.44.0. The repository has no releases or tags, so pin the commit and the schema URL.
  • Content capture: whether prompts, completions, system instructions and tool arguments may be recorded, and where (spans, events, or external storage).
  • Sources: when refreshing this skill, re-read every URL in Sources, check the repository for a tag or a new schema_url in model/manifest.yaml, and update the pins.

Invariants

  1. Everything here is Development. The conventions, spans, attributes, events and metrics carry Development status (GenAI README; manifest stability: development). Names can change between commits; record the schema URL you implemented.
  2. Existing instrumentations do not switch conventions silently. Instrumentations that emit v1.36.0 or earlier keep emitting it by default, and add OTEL_SEMCONV_STABILITY_OPT_IN with the value gen_ai_latest_experimental to emit the latest experimental conventions instead of the old ones (semantic conventions v1.41.1 GenAI README).
  3. gen_ai.operation.name is Required on every GenAI span, and gen_ai.provider.name on inference, embeddings, create_agent and client invoke_agent spans. Use a well-known value when one applies; otherwise a custom value is allowed (spans, agent spans, registry).
  4. Span names are low-cardinality: {gen_ai.operation.name} {gen_ai.request.model} for inference and embeddings, execute_tool {gen_ai.tool.name}, invoke_agent {gen_ai.agent.name}, create_agent {gen_ai.agent.name} (spans, agent spans).
  5. Span kind follows the call: CLIENT for remote model, embeddings and agent-service calls (INTERNAL allowed for in-process models); INTERNAL for execute_tool and in-process invoke_agent (spans, agent spans).
  6. A span covers the whole logical operation, including automatic retries, until the response is fully received or the operation ends in an error or cancellation (spans, Spans).
  7. Content is not captured by default. gen_ai.system_instructions, gen_ai.input.messages, gen_ai.output.messages, gen_ai.tool.definitions, gen_ai.tool.call.arguments and gen_ai.tool.call.result are Opt-In; offer an option to enable them (spans, Capturing instructions, inputs, and outputs).
  8. Errors set error.type, and span status follows the Recording Errors document (spans).
  9. Token counts report billable tokens when a system reports both used and billable tokens, and the per-operation histograms are never used for totals or cost (token metrics).

Workflow

  1. Choose the spans. Map each GenAI call in the code to an inference, embeddings, retrieval, execute_tool, create_agent, invoke_agent, invoke_workflow or MCP span. -> references/spans.md ✓ Each call site has a span type, a name pattern and a span kind.
  2. Set the attributes. Fill the Required and Conditionally Required attributes, then the Recommended ones the response provides, such as usage and finish reasons. -> references/attributes.md ✓ No span lacks gen_ai.operation.name or (where required) gen_ai.provider.name.
  3. Decide on content capture. Default off; if enabled, choose span attributes or external storage, and apply truncation. -> references/attributes.md ✓ A configuration flag controls capture and is off by default.
  4. Record metrics and events. Emit gen_ai.client.operation.duration with the advised buckets, the token usage counters, and the exception and evaluation events where they apply. -> references/events-metrics.md ✓ Duration and token metrics carry the required attributes, including gen_ai.token.modality on token counters.
  5. Handle versions. Pin the schema URL and, for an existing instrumentation, gate the new conventions behind OTEL_SEMCONV_STABILITY_OPT_IN. -> references/versioning.md ✓ The emitted schema URL and the opt-in behaviour are documented for users.

Verify before done

  • Every GenAI span has gen_ai.operation.name with a well-known value where one applies.
  • Inference, embeddings, create_agent and client invoke_agent spans have gen_ai.provider.name; server.port is set whenever server.address is.
  • Span names follow the patterns above and contain no IDs or prompt text.
  • Opt-In content attributes are off unless the user enabled them.
  • A failed call sets error.type and ends the span.
  • Token counters use {token}, durations use s, and the schema URL is recorded.

Reference index

  • references/spans.md: inference, embeddings, retrieval, execute_tool, agent and workflow spans, and MCP spans. Load for step 1.
  • references/attributes.md: key gen_ai.* attributes, well-known values, usage attributes, and the content capture patterns. Load for steps 2 and 3.
  • references/events-metrics.md: client, server, agent and tool metrics, token metrics, and the GenAI events. Load for step 4.
  • references/versioning.md: Development status, the repository move, the schema URL pin, and OTEL_SEMCONV_STABILITY_OPT_IN. Load for step 5.

Related skills

  • ocsf to turn AI activity into security audit events: npx skills add ScaleDockHQ/scaledock-skills --skill ocsf.
  • cloudevents to carry trace context on events with traceparent: npx skills add ScaleDockHQ/scaledock-skills --skill cloudevents.

Sources

Status uses the publishing body's own maturity term. Checked is the date the source was last read.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.