Skip to content

Comments

Fix session metric and add context window utilization tracking#1

Open
hev wants to merge 1 commit intoColeMurray:mainfrom
hev:feature/session-and-context-metrics
Open

Fix session metric and add context window utilization tracking#1
hev wants to merge 1 commit intoColeMurray:mainfrom
hev:feature/session-and-context-metrics

Conversation

@hev
Copy link

@hev hev commented Jan 6, 2026

Summary

  • Fix session count showing 0: The claude_code_session_count_total metric is documented but not actually emitted by Claude Code. Changed query to derive session count from existing metrics using count(count by (session_id)(claude_code_cost_usage_USD_total)).

  • Add context window utilization panel: New stat panel in dashboard overview showing max context window usage as a percentage with color-coded thresholds (green <50%, yellow 50-70%, orange 70-85%, red >85%).

  • Document derived metrics: Added new section to CLAUDE_OBSERVABILITY.md explaining how to calculate context window utilization from raw telemetry data, including model context limits.

Test plan

  • Verify session count panel now shows correct count (derives from cost metrics)
  • Verify context window utilization panel displays in overview section
  • Confirm color thresholds work correctly based on utilization percentage

🤖 Generated with Claude Code

- Fix session count showing 0: derive from existing metrics since
  claude_code_session_count_total is not emitted by Claude Code
- Add context window utilization panel to dashboard overview section
- Document derived metrics including context window % calculation
- Adjust overview panel widths to fit 5 stat panels

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Slack: https://hevmindworkspace.slack.com/archives/C0A6L0UFU6R/p1767715841456769
zyd14 added a commit to empiricotx/claude-code-otel that referenced this pull request Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant