Opentelemetry

From bendrucker/claude · View interactive version

Opentelemetry is an AI agent skill from the GitHub repository bendrucker/claude. OpenTelemetry instrumentation conventions. Use when instrumenting code with spans, setting up tracing, or writing trace tests.

How to use this skill

Skill file

OpenTelemetry

Span Naming

Use short, low-cardinality names from semantic conventions:

Attributes

Use semantic convention attribute names — never invent your own:

Import from the versioned semconv package (e.g., go.opentelemetry.io/otel/semconv/v1.x).

Status

Only set status on errors: span.SetStatus(codes.Error, err.Error()). Never set Ok — unset is the success state. Call RecordError alongside SetStatus; it only adds a span event, doesn't change status.

For HTTP: 4xx is Error on client spans, Unset on server spans. 5xx is always Error.

Testing

Use in-memory exporters with SimpleSpanProcessor (not batch — batch introduces timing). Assert on exported spans' names, attributes, and status. No mocking needed.

Boundaries

Instrument network calls, I/O, and queue operations — not every function. Use span events (AddEvent) instead of separate log statements for events within a traced operation.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.