Skip to content

feat: add duration percentiles to analytics - #200

Open
WilliamK112 wants to merge 1 commit into
pavanvamsi3:mainfrom
WilliamK112:agent/analytics-duration-percentiles
Open

feat: add duration percentiles to analytics#200
WilliamK112 wants to merge 1 commit into
pavanvamsi3:mainfrom
WilliamK112:agent/analytics-duration-percentiles

Conversation

@WilliamK112

Copy link
Copy Markdown

Summary

  • add p50Duration, p90Duration, and p99Duration to AnalyticsData and the analytics API payload
  • calculate duration percentiles with the deterministic nearest-rank method
  • keep all duration summary fields at zero when no positive duration samples exist
  • cover empty, singleton, unsorted, and input-nonmutation cases

Why

Average, minimum, and maximum duration are sensitive to outliers and do not describe a typical session well. The added percentiles make the existing analytics response more useful without changing how session durations are collected.

Validation

  • npm test (123 passed)
  • npm run typecheck
  • npm run build
  • git diff --check

Closes #182

AI-assisted: Codex was used to help implement and validate this change; the final diff and tests were reviewed locally.

Signed-off-by: WilliamK112 <164879897+WilliamK112@users.noreply.github.com>
@WilliamK112
WilliamK112 marked this pull request as ready for review August 12, 2026 11:39
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.

Add p50/p90/p99 duration percentiles to analytics response

1 participant