Span naming
Span names are the backbone of filtering, dashboards, and “diffing” traces across releases. The goal is to make names stable, small in number, and meaningful.
Principles
- Stable: names should not change when code moves.
- Comparable: the same step should have the same name in every service.
- Compositional: names should encode the domain and action.
Recommended format
Use domain.action (or area.action) such as:
retrieval.queryretrieval.rerankllm.completiontool.executeguardrails.validatecache.lookup
Anti-patterns
- Dynamic names:
tool.execute.search_${provider} - Code-centric names:
callOpenAI,fetchDocsFromDB - Too many variants:
llm.call.openai,llm.call.anthropic(use metadata for provider/model)
Use metadata for variability
Keep span name constant and add:
provider:openaimodel:gpt-4.1tool:web.searchindex:docs_v3