Skip to content

Conversation

jasonyuezhang
Copy link
Owner

The chart debug view just rendered every chart on one page which wasn't super easy to work with so this PR breaks them out into Discover charts and metric alert charts and adds a little section to the dropdown so you can easily toggle between them.

Why am I doing this? I need to update the data that we send to metric issue notification charts to use the open period data instead of the incident data, and it's going to require a lot of changes. I noticed a few things working with charts could be improved so I'm starting here.

Now
Screenshot 2025-10-06 at 4 21 44 PM

Before
Screenshot 2025-10-06 at 4 35 24 PM


Copied from getsentry#101048
Original PR: getsentry#101048

Copy link

Refactor and Organize Debug Chart Views into Separate Discover and Metric Alert Views

This pull request refactors the debug chart functionality by dividing the previously unified chart rendering view into two distinct views: one for Discover charts and another for metric alert charts. The change also reorganizes related URL routes, updates the mail preview UI to allow easy toggling between chart sections, and adjusts corresponding tests to align with the new structure. The purpose is to improve maintainability and usability, setting groundwork for more substantial chart data updates in future work.

Key Changes

• Moved Discover chart rendering logic into a new file src/sentry/web/frontend/debug/charts/debug_chart_renderer.py with its own class DebugChartRendererView.
• Isolated metric alert chart rendering into src/sentry/web/frontend/debug/charts/metric_alert_charts.py under class DebugMetricAlertChartRendererView, with discover-specific sample data removed.
• Updated src/sentry/web/debug_urls.py to wire up the new chart views to /debug/charts/chart-renderer/ and /debug/charts/metric-alert-charts/ routes, replacing the old combined /debug/chart-renderer/ endpoint.
• Enhanced src/sentry/templates/sentry/debug/mail/preview.html to add a new "Charts" optgroup in the dropdown, supporting selection between Discover and Metric Alert chart previews.
• Modified the acceptance test tests/acceptance/chartcuterie/test_chart_renderer.py to use the updated /debug/charts/chart-renderer/ route.
• Removed duplicate chart data in the metric alert chart file; sample datasets for Discover charts are now only defined in the Discover chart module.

Affected Areas

src/sentry/web/frontend/debug/charts/debug_chart_renderer.py
src/sentry/web/frontend/debug/charts/metric_alert_charts.py
src/sentry/web/debug_urls.py
src/sentry/templates/sentry/debug/mail/preview.html
tests/acceptance/chartcuterie/test_chart_renderer.py

This summary was automatically generated by @propel-code-bot

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