OpenTelemetry tracing discipline: correct spans, propagation, and semantic conventions produce useful traces. Invoke whenever task involves any interaction with distributed tracing — span creation, context propagation, instrumentation, sampling configuration, or OpenTelemetry SDK setup.
Guides implementation of OpenTelemetry tracing with correct spans, context propagation, and semantic conventions.
npx claudepluginhub xobotyi/cc-foundryThis skill inherits all available tools. When active, it can use any tool Claude has access to.
references/context-propagation.mdreferences/instrumentation.mdreferences/sampling.mdreferences/sdk-components.mdreferences/semantic-conventions.mdreferences/span-data.mdreferences/spans.mdCreate spans for logical operations, propagate context across every boundary, use semantic conventions for attribute names. Every tracing decision — span granularity, attribute selection, sampling strategy — trades off cost against visibility.
| Topic | Reference | Contents |
|---|---|---|
| Spans | references/spans.md | Span anatomy, root spans, lifetime code patterns |
| Span data | references/span-data.md | Events format, links format, SDK limits table |
| Context propagation | references/context-propagation.md | W3C header format, propagator selection, baggage details, security |
| Instrumentation | references/instrumentation.md | Server/client/async code patterns, library rules, testing guidance |
| Sampling | references/sampling.md | Head/tail/combined strategies, decision guide, sampler types |
| Semantic conventions | references/semantic-conventions.md | HTTP/DB/messaging attribute lists, status mapping, general conventions |
| SDK components | references/sdk-components.md | Resource config, env vars, Collector deployment, exporter types |
A span represents a single unit of work in a trace — an HTTP request handler, a database query, a message publish. Not every function call.
Name spans for the class of operation, not the instance. Low-cardinality names enable aggregation; high-cardinality names destroy it.
{METHOD} {route} — server: GET /users/:id; client: GET{operation} {table} — SELECT users, INSERT orders| Name | Verdict |
|---|---|
get | Too general |
get_account/42 | Too specific — ID in name |
get_account | Good |
GET /users/{userId} | Good — route template |
POST /api/v2/orders/abc123 | Bad — order ID in name |
SpanKind tells backends how to assemble the trace tree. Set it correctly.
| Kind | Direction | Use For |
|---|---|---|
SERVER | Incoming | HTTP handler, gRPC server method |
CLIENT | Outgoing | HTTP client call, DB query, gRPC call |
PRODUCER | Outgoing | Enqueue message, schedule job |
CONSUMER | Incoming | Dequeue message, process job |
INTERNAL | Neither | In-process business logic, computation |
CLIENT -> SERVER for synchronous calls; PRODUCER -> CONSUMER for asyncINTERNAL for HTTP handlers or DB calls is wrong — use SERVER or CLIENT| Status | Meaning | When to Set |
|---|---|---|
Unset | No error | Default — do not change on success |
Error | Operation failed | When an error occurs; include description |
Ok | Explicitly successful | Only to override a previous Error; rarely needed |
Unset on success — it already means "no error"Ok is a "final call" — once set, subsequent Error attempts are ignoredOk — leave to application codeend(), the span becomes non-recording; further mutations are ignoreddefer (Go), try/finally (Java/JS),
context manager (Python)Key-value pairs annotating a span. Value types: string, boolean, integer, float, or arrays of these.
http.request.method, db.system,
not custom names. Consistent naming enables cross-service analysis.IsRecording before expensive attribute computation — sampled-out spans
discard all data.AttributeCountLimit (default 128). Excess
attributes are silently dropped.Timestamped annotations — structured log entries attached to a span.
RecordException with setStatus(ERROR) — RecordException alone does
not change span statusAssociate a span with spans from other traces without parent-child hierarchy.
See references/span-data.md for events format, links format, and SDK limits table.
Context propagation correlates spans across service boundaries. Without it, each service produces isolated spans — no distributed trace.
Propagates arbitrary key-value pairs across service boundaries alongside trace context.
See references/context-propagation.md for W3C header format, propagator selection
table, baggage details, and security considerations.
| Approach | When | Trade-off |
|---|---|---|
| Automatic | Supported libraries (HTTP, DB, messaging) | Zero code, no business attrs |
| Manual | Business logic, unsupported libraries | Full control, more code |
| Hybrid (recommended) | Production | Auto for infra + manual for business logic |
TracerProvider via dependency injection or use the global oneTracerProviderGood candidates: public API methods with I/O or significant computation, request/message handlers, outbound calls (HTTP, DB, RPC), background jobs.
Poor candidates: every function call (noise), thin wrapper libraries (already instrumented underneath), pure computation with no I/O and sub-ms duration.
Decision: Is it a network call or significant I/O? -> Create span (CLIENT/SERVER). Is it a meaningful business operation? -> Create span (INTERNAL). Would a span event on parent suffice? -> Add event. Otherwise -> don't instrument.
schema_url to record which semantic convention version you useTracerProvider injection for testabilitySee references/instrumentation.md for server-side, client-side, and async
producer/consumer patterns, plus testing guidance.
Sampling controls which traces are recorded and exported — the primary mechanism for managing tracing costs.
Decision at trace creation time, before any spans complete.
| Sampler | Behavior |
|---|---|
AlwaysOn | Record and sample everything |
AlwaysOff | Drop everything |
TraceIdRatioBased(ratio) | Sample based on trace ID hash |
ParentBased(root) | Delegate based on parent sampling decision |
ParentBased is the most common production configuration — respects parent decisions,
applies custom root sampling. Default SDK sampler: ParentBased(root=AlwaysOn).
Decision after all spans in a trace complete. Requires collector infrastructure.
ParentBased — children follow parent decisions for complete tracesSee references/sampling.md for combined head+tail strategies, decision guide, and
per-scenario recommendations.
Use semantic conventions for span names and attributes. Consistent naming enables cross-service analysis without learning custom attribute names.
SERVER, name {METHOD} {http.route}, never full URI pathCLIENT, name {METHOD}CLIENT, name {operation} {target}, always sanitize queriesPRODUCER, name {destination} publishCONSUMER, name {destination} processSee references/semantic-conventions.md for required/recommended attributes per domain,
status mapping rules, and general conventions.
shutdown() on exit — flushes remaining spansResource with service.name — identifies your service in backendsBatchSpanProcessor in production — SimpleSpanProcessor is for dev/testing onlySee references/sdk-components.md for Resource attributes, BatchSpanProcessor tuning,
exporter types, environment variable configuration, and Collector deployment patterns.
When writing tracing code:
When reviewing tracing code:
span.end().The coding skill governs workflow; this skill governs tracing implementation choices. Language-specific skills handle SDK API differences.
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.
Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.