Skip to content

fix(explorer): bucket on page charts#104653

Merged
roaga merged 1 commit intomasterfrom
explorer/bucket-on-page-charts
Dec 10, 2025
Merged

fix(explorer): bucket on page charts#104653
roaga merged 1 commit intomasterfrom
explorer/bucket-on-page-charts

Conversation

@roaga
Copy link
Copy Markdown
Contributor

@roaga roaga commented Dec 9, 2025

Before when getting values for on-page charts, we'd sample the value at each timestamp. This could accidentally miss spikes.
Now, we choose an interval and sum data within each interval to more accurately represent the data being shown.

Closes AIML-2016

@roaga roaga requested a review from aliu39 December 9, 2025 23:22
@roaga roaga requested a review from a team as a code owner December 9, 2025 23:22
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Dec 9, 2025
@linear
Copy link
Copy Markdown

linear bot commented Dec 9, 2025


// Align bucket start to round intervals (e.g., start of minute/hour)
const alignedMinX = Math.floor(minX / bucketSizeMs) * bucketSizeMs;
const numBuckets = Math.ceil((maxX - alignedMinX) / bucketSizeMs);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Zero buckets causes data loss and undefined key access

When all data points share the same timestamp that's exactly aligned to a bucket boundary (e.g., precisely on the minute), and there are more than 50 points, numBuckets computes to 0 via Math.ceil((maxX - alignedMinX) / bucketSizeMs). This causes displayTimestamps to be empty, bucketIndex to be -1, and displayTimestamps[bucketIndex] to be undefined. Data then gets keyed by undefined in the map, and the resulting table has no data rows since iteration over empty displayTimestamps produces nothing.

Additional Locations (1)

Fix in Cursor Fix in Web

@roaga roaga merged commit e589dcd into master Dec 10, 2025
49 checks passed
@roaga roaga deleted the explorer/bucket-on-page-charts branch December 10, 2025 18:05
@github-actions github-actions bot locked and limited conversation to collaborators Dec 26, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants