Repository navigation
fix(web): service overview throughput uses the queried window - #1281
Conversation
getServiceOverview falls back to a 24h window when no range is passed, but computed the rate duration from the raw inputs, which fall back to 3600s. Throughput came out 24x too high on the default window.
Maple review🟢 Confidence 9/10 · safe to merge
What was checked
|
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing (2)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
What
getServiceOverviewresolves a 24h fallback window when the caller passes nostartTime/endTime, and runs the query on that window. The rate divisor was computed from the raw inputs instead (windowDurationSeconds(input.startTime, input.endTime)), which falls back to 3600s. On the default window every throughput came out 24x too high.The divisor now uses the resolved
startTime/endTime, the same window the query ran on.Test
New case in
services.test.ts: no range passed, 100 spans, expects100 / 86400. It fails on the old code (100 / 3600) and passes with the fix. It usesit.livebecause the TestClock sits at epoch 0, where the fallback window has no positive start.Context for reviewers
This came out of investigating a reported spike on the last point of the service detail throughput chart. That chart path checked out end to end (compiled SQL matched raw counts per bucket, including the trailing bucket; the web divides every bucket by one width), so this PR does not touch it. The likely cause there is the API bucket cache serving buckets cached before reseeded local data landed. Separately worth deciding: the cache treats buckets as settled after 60s (
QE_BUCKET_CACHE_FLUX_SECONDS), while the web treats the last 120s as still filling.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.