OTEL Attribute Conventions for AI Tracing
Semantic attribute conventions for AI observability used by the Spanora platform and SDK. Covers gen_ai.* standard attributes and spanora.* custom attributes.
The SDK emits gen_ai.* (OTEL GenAI Semantic Conventions) where a standard attribute exists, and spanora.* only for attributes with no gen_ai equivalent. The backend recognizes both, plus OpenInference and Vercel AI SDK namespaces.
Standard Attributes (gen_ai.*)
| Attribute | Description | Example |
|---|---|---|
gen_ai.provider.name | LLM provider | "openai" |
gen_ai.request.model | Model name | "gpt-4" |
gen_ai.input.messages | Prompt input | JSON array |
gen_ai.output.messages | Model output | JSON array |
gen_ai.usage.input_tokens | Input token count | 150 |
gen_ai.usage.output_tokens | Output token count | 89 |
gen_ai.tool.name | Tool name | "search_docs" |
gen_ai.tool.input | Tool call input arguments | '{"query":"docs"}' |
gen_ai.tool.output | Tool call output | '{"results":[...]}' |
gen_ai.conversation.id | Session/conversation ID | "sess_abc123" |
gen_ai.agent.name | Agent name | "support-bot" |
gen_ai.operation.name | LLM operation type (set per-span by trackLlm/provider wrappers, not by track()) | "chat" |
Custom Attributes (spanora.*)
These attributes have no gen_ai equivalent:
| Attribute | Description | Example |
|---|---|---|
spanora.agent.version | Agent version | "1.2.0" |
spanora.user.id | User context | "user_123" |
spanora.org.id | Tenant context | "org_456" |
spanora.agent.outcome | Execution outcome | "success" |
spanora.agent.failure.reason | Failure reason | "timeout" |
spanora.tool.status | Tool execution status | "ok" |
Usage Example
span.setAttributes({
// Standard gen_ai attributes
"gen_ai.provider.name": "openai",
"gen_ai.request.model": "gpt-4",
"gen_ai.operation.name": "chat",
// Custom attributes (no gen_ai equivalent)
"spanora.user.id": "user_123",
"spanora.org.id": "org_456",
});