active_time metric not being emitted for ~50% of sessions

Resolved 💬 3 comments Opened Jan 6, 2026 by maecapozzi Closed Jan 10, 2026

Description

The claude_code.active_time.total metric is not being emitted for approximately 50% of Claude Code sessions, despite cost and token metrics being successfully recorded for the same sessions.

Impact

This affects the ability to:

  • Calculate efficiency metrics (e.g., cost per hour of active time)
  • Understand actual user engagement time with Claude Code
  • Create accurate productivity dashboards

Data Evidence

From analysis of the claude dataset in localdev-analytics environment (last 7 days):

  • 126 sessions have claude_code.cost.usage data but missing claude_code.active_time.total
  • Total cost without active_time: $263.16
  • Affects 20+ users across multiple versions

Example Session

Session ID: 2085ece8-1d31-4460-aab9-380838ac003b (user: ronyaguilar@honeycomb.io)

  • Version: 2.0.62
  • Total events: 1,640 metric events
  • Has cost data: ✅ Yes ($33.32)
  • Has active_time data: ❌ No (0 events contain the field)

Affected Versions

Observed across multiple versions including:

  • 2.0.62
  • 2.0.70
  • 2.0.76

Technical Details

  • active_time should be emitted as a metric event (meta.signal_type = "metric")
  • Cost and token metrics ARE being successfully emitted for these same sessions
  • The active_time field is completely absent from events (not just zero values)

Possible Causes

  1. Metric not being emitted on certain session termination paths (e.g., crashes, force-quit)
  2. Bug in metric emission code for specific usage patterns
  3. Race condition or timing issue at session end

Reproduction

Unable to identify specific reproduction steps, as the issue affects various users, versions, and usage patterns inconsistently.

Expected Behavior

Every session that emits claude_code.cost.usage should also emit claude_code.active_time.total.

Query to Reproduce Finding

Environment: localdev-analytics
Dataset: claude
Query:
  SUM(claude_code.cost.usage), COUNT_DISTINCT(session.id)
  WHERE claude_code.cost.usage exists AND claude_code.active_time.total does-not-exist
  Time range: Last 7 days

Result: 126 sessions, $263.16 total cost

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗