Repository navigation
fix(web): bound HistogramCache range to the inspection query time range - #1037
Merged
Merged
Conversation
kyasbal
requested review from
K53,
jyane,
kkuchima and
renamoo
as code owners
September 25, 2026 07:54
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors HistogramCache to accept explicit range boundaries (rangeBeginTimeMs and rangeEndTimeMs) instead of deriving them from the logs, preventing unbounded bucket count inflation from outlier logs. Call sites in TimelineFrameComponent and associated unit tests have been updated, and new tests were added to verify range boundaries. Feedback is provided regarding a potential issue where out-of-bounds writes and NaN propagation can occur if bucketCount exceeds windowCount, with a suggestion to dynamically allocate Float32Array buffers of size bucketCount.
Merged
via the queue into
GoogleCloudPlatform:main
with commit Sep 25, 2026
d402902
17 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Opening some inspection files fails.
HistogramCachetried to allocate typed arrays with ~500M elements (windowCount = 502696905was observed).Cause
HistogramCacheused two different sources for its size:minBucketTime): the inspection query range divided into 10000 buckets.A single log far outside the query range makes the bucket count grow without bound. For example, with a 1 hour query the bucket width is 500ms, and 502,696,904 buckets x 500ms is about 8 years. Cloud Asset Inventory snapshot logs can be stamped with the asset's last change time (
TemporalAsset.Window.StartTime), which can be years before the query start.Fix
HistogramCachenow takes the histogram range as required arguments (rangeBeginTimeMs,rangeEndTimeMs) instead of deriving it from logs. The bucket containing the range end is included.timeline-framepasses the inspection query range (minQueryLogTimeMS/maxQueryLogTimeMS) to both the all-logs and filtered-logs caches. The rest of the timeline (horizontal scroll, chart draw range, range selection) already uses this range.logMinTimeMS/logMaxTimeMSfields.Tests
make test-web(1417 passed),make lint-web,make build-storybookpass.