Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(perf): track js heap size on canvas context loss and dashboard load #28381

Merged
merged 2 commits into from
Feb 10, 2025

Conversation

thmsobrmlr
Copy link
Contributor

@thmsobrmlr thmsobrmlr commented Feb 6, 2025

Problem

I suspect that canvas elements lose their context due to OOMing for a customer: #28379.

Changes

This PR uses Chromiums's non-standard memory extension to capture heap usage after each dashboard load and when a canvas context loss is detected. I'm hoping to confirm/reject the OOM hypothesis for the customer issue with this.

How did you test this code?

Ran locally

Screenshot 2025-02-06 at 15 32 10

@thmsobrmlr thmsobrmlr requested a review from a team February 6, 2025 14:32
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

Added JavaScript heap memory tracking to diagnose potential out-of-memory issues causing canvas context loss in dashboards and visualizations.

  • Added memory metrics collection in /frontend/src/scenes/dashboard/dashboardLogic.tsx during dashboard loads and time-to-see-data reporting
  • Implemented getJSHeapMemory() utility in /frontend/src/lib/utils.tsx to capture heap usage metrics using Chrome's performance.memory API
  • Added memory tracking in /frontend/src/scenes/insights/views/LineGraph/LineGraph.tsx when canvas context loss events occur
  • Memory tracking is non-intrusive and gracefully handles browsers without the performance.memory API

3 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

Copy link
Contributor

github-actions bot commented Feb 6, 2025

Size Change: 0 B

Total Size: 1.18 MB

ℹ️ View Unchanged
Filename Size
frontend/dist/toolbar.js 1.18 MB

compressed-size-action

Copy link
Contributor

@aspicer aspicer left a comment

Choose a reason for hiding this comment

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

✅ to unblock if you think this is worthwhile, but as i mentioned on slack, this crashes on my machine and doesn't seem to be memory limited.

seems to be a bug in GPU rendering in chrome.

@thmsobrmlr thmsobrmlr enabled auto-merge (squash) February 10, 2025 12:23
@thmsobrmlr thmsobrmlr merged commit cf2c3ab into master Feb 10, 2025
103 checks passed
@thmsobrmlr thmsobrmlr deleted the instrument-dashboard-memory-usage branch February 10, 2025 12:40
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.

2 participants