feat(analytics): add latency histogram buckets to analytics summary#96
feat(analytics): add latency histogram buckets to analytics summary#96brodapeethar wants to merge 2 commits into
Conversation
Add latencyBuckets field to AnalyticsSummary showing query execution time distribution across <1s, 1-3s, 3-10s, >10s, and unknown buckets. Closes emrekayat#89
|
@brodapeethar is attempting to deploy a commit to the emrekayat's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Thanks for the PR. I checked this from the emrekayat account. I cannot run a proper merge-ref review or merge it yet because GitHub reports the branch as Once it is mergeable, I will recheck the analytics latency bucket logic, shared/web types, and the API tests. |
|
@brodapeethar Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
@emrekayat please review and merge |
|
Thanks for the update. I rechecked the latest merge ref from the maintainer account after #112 landed, but this still is not merge-ready. Commands run: git diff --check main...pr-96-merge
npm run test --workspace @query402/shared
npm run test --workspace @query402/api -- src/routes/public.test.tsShared tests pass, but the API public route test fails: The new |
Summary
Adds latency bucket counts to the analytics API to provide investor-grade performance visibility for paid query execution. Analytics now returns execution time distribution across five latency bands without changing provider execution or payment behavior.
Changes
packages/shared/src/types.ts— AddedLatencyBuckettype ("<1s" | "1-3s" | "3-10s" | ">10s" | "unknown") andlatencyBuckets: Record<LatencyBucket, number>toAnalyticsSummaryapps/api/src/lib/storage/serialization.ts— ImplementedclassifyLatency()and bucket computation inbuildAnalyticsSummary(); zeroed buckets on empty storage; unknown/missing latency counted separatelyapps/web/src/types.ts— AddedlatencyBucketstoAnalyticsResponseusing the sharedLatencyBuckettypeapps/api/src/routes/public.test.ts— Updated empty-storage test to assert zeroed buckets; added dedicated test covering fast (500ms), medium (2s), slow (5s), very-slow (15s), and unknown (0ms) recordsCloses
Closes #89