[FEATURE] Include custom session title as OTLP resource attribute in telemetry
Summary
When a Claude Code session has a custom title set, emit it as an OTLP resource attribute so it flows through automatically to Prometheus, Grafana, and other observability backends.
Motivation
Claude Code already emits OTLP telemetry (cost, token usage) when CLAUDE_CODE_ENABLE_TELEMETRY=1 is set. However, there is currently no way to correlate these metrics with a specific task or feature being worked on.
A common pattern in engineering teams using Claude Code for autonomous feature implementation is to name sessions after the work item — for example FCS-123. If this name were included as an OTLP resource attribute, Prometheus queries could filter by it and Grafana dashboards could show cost and token usage per feature, not just per session UUID.
Proposed behaviour
Two parts:
- Built-in command to set the session title — a slash command or CLI flag (e.g.
/title FCS-123orclaude --title "FCS-123") so the title can be set programmatically at session start, including from scripts and skill invocations.
- Emit the title as an OTLP resource attribute — when a session has a custom title, include it in all OTLP telemetry:
````
session.name = "FCS-123"
This flows naturally through any OTLP-compatible collector to Prometheus labels, Grafana dimensions, Datadog tags, etc.
Example use case
# Start a feature implementation session tagged to a work item
claude --title "FCS-123"
# Grafana query: cost per feature
sum by (session_name) (claude_code_cost_usage_total)
Related
- #32150 — Session titles revert after session close (related: custom-title reliability)
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗