diff --git a/src/sentry/templates/sentry/debug/mail/preview.html b/src/sentry/templates/sentry/debug/mail/preview.html
index 8f7b686f4f2380..960127d71b7448 100644
--- a/src/sentry/templates/sentry/debug/mail/preview.html
+++ b/src/sentry/templates/sentry/debug/mail/preview.html
@@ -42,6 +42,10 @@
+
diff --git a/src/sentry/web/debug_urls.py b/src/sentry/web/debug_urls.py
index 6b420bea7542b7..ff5e8bbb8c025a 100644
--- a/src/sentry/web/debug_urls.py
+++ b/src/sentry/web/debug_urls.py
@@ -3,12 +3,13 @@
import sentry.web.frontend.debug.mail
from sentry.web.frontend.debug import debug_auth_views
+from sentry.web.frontend.debug.charts.debug_chart_renderer import DebugChartRendererView
+from sentry.web.frontend.debug.charts.metric_alert_charts import DebugMetricAlertChartRendererView
from sentry.web.frontend.debug.debug_assigned_email import (
DebugAssignedEmailView,
DebugSelfAssignedEmailView,
DebugSelfAssignedTeamEmailView,
)
-from sentry.web.frontend.debug.debug_chart_renderer import DebugChartRendererView
from sentry.web.frontend.debug.debug_codeowners_auto_sync_failure_email import (
DebugCodeOwnersAutoSyncFailureView,
)
@@ -155,7 +156,8 @@
),
re_path(r"^debug/oauth/authorize/$", DebugOAuthAuthorizeView.as_view()),
re_path(r"^debug/oauth/authorize/error/$", DebugOAuthAuthorizeErrorView.as_view()),
- re_path(r"^debug/chart-renderer/$", DebugChartRendererView.as_view()),
+ re_path(r"^debug/charts/chart-renderer/$", DebugChartRendererView.as_view()),
+ re_path(r"^debug/charts/metric-alert-charts/$", DebugMetricAlertChartRendererView.as_view()),
re_path(r"^debug/mail/cron-broken-monitor-email/$", DebugCronBrokenMonitorEmailView.as_view()),
re_path(r"^debug/mail/cron-muted-monitor-email/$", DebugCronMutedMonitorEmailView.as_view()),
]
diff --git a/src/sentry/web/frontend/debug/charts/debug_chart_renderer.py b/src/sentry/web/frontend/debug/charts/debug_chart_renderer.py
new file mode 100644
index 00000000000000..e57b0b648e38c5
--- /dev/null
+++ b/src/sentry/web/frontend/debug/charts/debug_chart_renderer.py
@@ -0,0 +1,397 @@
+from django.http import HttpRequest, HttpResponse
+from django.views.generic import View
+
+from sentry.charts import backend as charts
+from sentry.charts.types import ChartType
+from sentry.web.frontend.debug.mail import MailPreview
+
+discover_total_period = {
+ "seriesName": "Discover total period",
+ "stats": {
+ "data": [
+ [1616168400, [{"count": 0}]],
+ [1616168700, [{"count": 12}]],
+ [1616169000, [{"count": 13}]],
+ [1616169300, [{"count": 9}]],
+ [1616169600, [{"count": 12}]],
+ [1616169900, [{"count": 21}]],
+ [1616170200, [{"count": 11}]],
+ [1616170500, [{"count": 22}]],
+ [1616170800, [{"count": 18}]],
+ [1616171100, [{"count": 15}]],
+ [1616171400, [{"count": 14}]],
+ [1616171700, [{"count": 31}]],
+ [1616172000, [{"count": 18}]],
+ [1616172300, [{"count": 13}]],
+ [1616172600, [{"count": 17}]],
+ [1616172900, [{"count": 9}]],
+ [1616173200, [{"count": 9}]],
+ [1616173500, [{"count": 13}]],
+ [1616173800, [{"count": 11}]],
+ ],
+ },
+}
+
+discover_geo = {
+ "seriesName": "Discover total period",
+ "stats": {
+ "data": [
+ {"geo.country_code": "US", "count": 1},
+ {"geo.country_code": "GB", "count": 30},
+ {"geo.country_code": "AU", "count": 20},
+ ],
+ },
+}
+
+discover_total_daily = {
+ "seriesName": "Discover total daily",
+ "stats": {
+ "data": [
+ [1615852800, [{"count": 2426486}]],
+ [1615939200, [{"count": 18837228}]],
+ [1616025600, [{"count": 14662530}]],
+ [1616112000, [{"count": 15102981}]],
+ [1616198400, [{"count": 7759228}]],
+ [1616284800, [{"count": 7216556}]],
+ [1616371200, [{"count": 16976035}]],
+ [1616457600, [{"count": 17240832}]],
+ [1616544000, [{"count": 16814701}]],
+ [1616630400, [{"count": 17480989}]],
+ [1616716800, [{"count": 15387478}]],
+ [1616803200, [{"count": 8467454}]],
+ [1616889600, [{"count": 6382678}]],
+ [1616976000, [{"count": 16842851}]],
+ [1617062400, [{"count": 12959057}]],
+ ],
+ },
+}
+
+discover_total_daily_multi = {
+ "seriesName": "Discover total daily",
+ "stats": {
+ "count()": {
+ "data": [
+ [1615852800, [{"count": 2426486}]],
+ [1615939200, [{"count": 18837228}]],
+ [1616025600, [{"count": 14662530}]],
+ [1616112000, [{"count": 15102981}]],
+ [1616198400, [{"count": 7759228}]],
+ [1616284800, [{"count": 7216556}]],
+ [1616371200, [{"count": 16976035}]],
+ [1616457600, [{"count": 17240832}]],
+ [1616544000, [{"count": 16814701}]],
+ [1616630400, [{"count": 17480989}]],
+ [1616716800, [{"count": 15387478}]],
+ [1616803200, [{"count": 8467454}]],
+ [1616889600, [{"count": 6382678}]],
+ [1616976000, [{"count": 16842851}]],
+ [1617062400, [{"count": 12959057}]],
+ ],
+ },
+ "count_unique(user)": {
+ "data": [
+ [1615852800, [{"count": 242648}]],
+ [1615939200, [{"count": 1883722}]],
+ [1616025600, [{"count": 1466253}]],
+ [1616112000, [{"count": 5102981}]],
+ [1616198400, [{"count": 759228}]],
+ [1616284800, [{"count": 216556}]],
+ [1616371200, [{"count": 6976035}]],
+ [1616457600, [{"count": 7240832}]],
+ [1616544000, [{"count": 1681470}]],
+ [1616630400, [{"count": 1748098}]],
+ [1616716800, [{"count": 1538747}]],
+ [1616803200, [{"count": 846745}]],
+ [1616889600, [{"count": 382678}]],
+ [1616976000, [{"count": 6842851}]],
+ [1617062400, [{"count": 2959057}]],
+ ],
+ },
+ },
+}
+
+discover_multi_y_axis = {
+ "seriesName": "count()",
+ "stats": {
+ "count()": {
+ "data": [
+ (1631559900, [{"count": 5}]),
+ (1631560200, [{"count": 8}]),
+ (1631560500, [{"count": 10}]),
+ (1631560800, [{"count": 10}]),
+ (1631561100, [{"count": 6}]),
+ (1631561400, [{"count": 5}]),
+ (1631561700, [{"count": 7}]),
+ (1631562000, [{"count": 5}]),
+ (1631562300, [{"count": 6}]),
+ (1631562600, [{"count": 4}]),
+ (1631562900, [{"count": 8}]),
+ (1631563200, [{"count": 5}]),
+ (1631563500, [{"count": 5}]),
+ (1631563800, [{"count": 7}]),
+ (1631564100, [{"count": 5}]),
+ (1631564400, [{"count": 9}]),
+ (1631564700, [{"count": 5}]),
+ ],
+ "end": "1631646300",
+ "order": "1",
+ "start": "1631559900",
+ },
+ "count_unique(user)": {
+ "data": [
+ (1631559900, [{"count": 0}]),
+ (1631560200, [{"count": 2}]),
+ (1631560500, [{"count": 3}]),
+ (1631560800, [{"count": 1}]),
+ (1631561100, [{"count": 1}]),
+ (1631561400, [{"count": 0}]),
+ (1631561700, [{"count": 1}]),
+ (1631562000, [{"count": 0}]),
+ (1631562300, [{"count": 1}]),
+ (1631562600, [{"count": 0}]),
+ (1631562900, [{"count": 1}]),
+ (1631563200, [{"count": 0}]),
+ (1631563500, [{"count": 0}]),
+ (1631563800, [{"count": 1}]),
+ (1631564100, [{"count": 0}]),
+ (1631564400, [{"count": 1}]),
+ (1631564700, [{"count": 0}]),
+ ],
+ "end": "1631646300",
+ "order": "0",
+ "start": "1631559900",
+ },
+ },
+}
+
+discover_top5 = {
+ "stats": {
+ "ludic-science,1st event": {
+ "data": [
+ [1615877940, [{"count": 0}]],
+ [1615878000, [{"count": 0}]],
+ [1615878060, [{"count": 0}]],
+ [1615878120, [{"count": 0}]],
+ [1615878180, [{"count": 1}]],
+ [1615878240, [{"count": 1}]],
+ [1615878300, [{"count": 1}]],
+ [1615878360, [{"count": 1}]],
+ [1615878420, [{"count": 1}]],
+ [1615878480, [{"count": 1}]],
+ [1615878540, [{"count": 1}]],
+ [1615878600, [{"count": 3}]],
+ [1615878660, [{"count": 1}]],
+ [1615878720, [{"count": 1}]],
+ [1615878780, [{"count": 1}]],
+ [1615878840, [{"count": 1}]],
+ [1615878900, [{"count": 1}]],
+ [1615878960, [{"count": 1}]],
+ [1615879020, [{"count": 1}]],
+ [1615879080, [{"count": 1}]],
+ [1615879140, [{"count": 1}]],
+ [1615879200, [{"count": 1}]],
+ [1615879260, [{"count": 1}]],
+ [1615879320, [{"count": 1}]],
+ [1615879380, [{"count": 0}]],
+ [1615879440, [{"count": 0}]],
+ [1615879500, [{"count": 0}]],
+ [1615879560, [{"count": 0}]],
+ [1615879620, [{"count": 0}]],
+ ],
+ "order": 0,
+ },
+ "ludic-science,2nd event": {
+ "data": [
+ [1615877940, [{"count": 0}]],
+ [1615878000, [{"count": 0}]],
+ [1615878060, [{"count": 0}]],
+ [1615878120, [{"count": 0}]],
+ [1615878180, [{"count": 1}]],
+ [1615878240, [{"count": 1}]],
+ [1615878300, [{"count": 1}]],
+ [1615878360, [{"count": 1}]],
+ [1615878420, [{"count": 1}]],
+ [1615878480, [{"count": 1}]],
+ [1615878540, [{"count": 1}]],
+ [1615878600, [{"count": 5}]],
+ [1615878660, [{"count": 3}]],
+ [1615878720, [{"count": 2}]],
+ [1615878780, [{"count": 1}]],
+ [1615878840, [{"count": 1}]],
+ [1615878900, [{"count": 1}]],
+ [1615878960, [{"count": 1}]],
+ [1615879020, [{"count": 1}]],
+ [1615879080, [{"count": 1}]],
+ [1615879140, [{"count": 1}]],
+ [1615879200, [{"count": 1}]],
+ [1615879260, [{"count": 1}]],
+ [1615879320, [{"count": 1}]],
+ [1615879380, [{"count": 0}]],
+ [1615879440, [{"count": 0}]],
+ [1615879500, [{"count": 0}]],
+ [1615879560, [{"count": 0}]],
+ [1615879620, [{"count": 0}]],
+ ],
+ "order": 1,
+ },
+ "Other": {
+ "data": [
+ [1615877940, [{"count": 2}]],
+ [1615878000, [{"count": 2}]],
+ [1615878060, [{"count": 2}]],
+ [1615878120, [{"count": 2}]],
+ [1615878180, [{"count": 0}]],
+ [1615878240, [{"count": 0}]],
+ [1615878300, [{"count": 0}]],
+ [1615878360, [{"count": 0}]],
+ [1615878420, [{"count": 0}]],
+ [1615878480, [{"count": 1}]],
+ [1615878540, [{"count": 2}]],
+ [1615878600, [{"count": 5}]],
+ [1615878660, [{"count": 3}]],
+ [1615878720, [{"count": 2}]],
+ [1615878780, [{"count": 1}]],
+ [1615878840, [{"count": 0}]],
+ [1615878900, [{"count": 0}]],
+ [1615878960, [{"count": 0}]],
+ [1615879020, [{"count": 0}]],
+ [1615879080, [{"count": 0}]],
+ [1615879140, [{"count": 0}]],
+ [1615879200, [{"count": 0}]],
+ [1615879260, [{"count": 0}]],
+ [1615879320, [{"count": 0}]],
+ [1615879380, [{"count": 2}]],
+ [1615879440, [{"count": 2}]],
+ [1615879500, [{"count": 2}]],
+ [1615879560, [{"count": 2}]],
+ [1615879620, [{"count": 2}]],
+ ],
+ "order": 2,
+ },
+ }
+}
+
+discover_empty = {
+ "seriesName": "Discover empty",
+ "stats": {
+ "data": [],
+ },
+}
+
+
+class DebugChartRendererView(View):
+ def get(self, request: HttpRequest) -> HttpResponse:
+ ret = []
+
+ ret.append(
+ {
+ "chart": charts.generate_chart(
+ ChartType.SLACK_DISCOVER_TOTAL_PERIOD, discover_total_period
+ ),
+ "title": "Slack Discover total period",
+ }
+ )
+ ret.append(
+ {
+ "chart": charts.generate_chart(
+ ChartType.SLACK_DISCOVER_TOTAL_PERIOD, discover_multi_y_axis
+ ),
+ "title": "Slack Discover total period multi y axis",
+ }
+ )
+ ret.append(
+ {
+ "chart": charts.generate_chart(
+ ChartType.SLACK_DISCOVER_TOTAL_PERIOD, discover_empty
+ ),
+ "title": "Slack Discover total period empty",
+ }
+ )
+ ret.append(
+ {
+ "chart": charts.generate_chart(
+ ChartType.SLACK_DISCOVER_TOTAL_DAILY, discover_total_daily
+ ),
+ "title": "Discover total daily",
+ }
+ )
+ ret.append(
+ {
+ "chart": charts.generate_chart(
+ ChartType.SLACK_DISCOVER_TOTAL_DAILY, discover_total_daily_multi
+ ),
+ "title": "Discover total daily multi",
+ }
+ )
+ ret.append(
+ {
+ "chart": charts.generate_chart(
+ ChartType.SLACK_DISCOVER_TOTAL_DAILY, discover_empty
+ ),
+ "title": "Discover total daily empty",
+ }
+ )
+ ret.append(
+ {
+ "chart": charts.generate_chart(ChartType.SLACK_DISCOVER_TOP5_PERIOD, discover_top5),
+ "title": "Slack Discover top5 period",
+ }
+ )
+ ret.append(
+ {
+ "chart": charts.generate_chart(
+ ChartType.SLACK_DISCOVER_TOP5_PERIOD, discover_empty
+ ),
+ "title": "Slack Discover top5 empty",
+ }
+ )
+ ret.append(
+ {
+ "chart": charts.generate_chart(
+ ChartType.SLACK_DISCOVER_TOP5_PERIOD_LINE, discover_top5
+ ),
+ "title": "Slack Discover top5 period line",
+ }
+ )
+ ret.append(
+ {
+ "chart": charts.generate_chart(
+ ChartType.SLACK_DISCOVER_TOP5_PERIOD_LINE, discover_empty
+ ),
+ "title": "Slack Discover top5 period line empty",
+ }
+ )
+ ret.append(
+ {
+ "chart": charts.generate_chart(ChartType.SLACK_DISCOVER_TOP5_DAILY, discover_top5),
+ "title": "Slack Discover top5 daily",
+ }
+ )
+ ret.append(
+ {
+ "chart": charts.generate_chart(ChartType.SLACK_DISCOVER_TOP5_DAILY, discover_empty),
+ "title": "Slack Discover top5 daily empty",
+ }
+ )
+ ret.append(
+ {
+ "chart": charts.generate_chart(
+ ChartType.SLACK_DISCOVER_PREVIOUS_PERIOD, discover_total_period
+ ),
+ "title": "Slack Discover previous period",
+ }
+ )
+ ret.append(
+ {
+ "chart": charts.generate_chart(
+ ChartType.SLACK_DISCOVER_PREVIOUS_PERIOD, discover_multi_y_axis
+ ),
+ "title": "Slack Discover previous period multi y axis",
+ }
+ )
+
+ return MailPreview(
+ html_template="sentry/debug/chart-renderer.html",
+ text_template="sentry/debug/chart-renderer.txt",
+ context={"charts": ret},
+ ).render(request)
diff --git a/src/sentry/web/frontend/debug/debug_chart_renderer.py b/src/sentry/web/frontend/debug/charts/metric_alert_charts.py
similarity index 52%
rename from src/sentry/web/frontend/debug/debug_chart_renderer.py
rename to src/sentry/web/frontend/debug/charts/metric_alert_charts.py
index 8fe4746d07a471..16e929654d738f 100644
--- a/src/sentry/web/frontend/debug/debug_chart_renderer.py
+++ b/src/sentry/web/frontend/debug/charts/metric_alert_charts.py
@@ -4,280 +4,7 @@
from sentry.charts import backend as charts
from sentry.charts.types import ChartType
from sentry.seer.anomaly_detection.types import AnomalyType
-from sentry.web.helpers import render_to_response
-
-discover_total_period = {
- "seriesName": "Discover total period",
- "stats": {
- "data": [
- [1616168400, [{"count": 0}]],
- [1616168700, [{"count": 12}]],
- [1616169000, [{"count": 13}]],
- [1616169300, [{"count": 9}]],
- [1616169600, [{"count": 12}]],
- [1616169900, [{"count": 21}]],
- [1616170200, [{"count": 11}]],
- [1616170500, [{"count": 22}]],
- [1616170800, [{"count": 18}]],
- [1616171100, [{"count": 15}]],
- [1616171400, [{"count": 14}]],
- [1616171700, [{"count": 31}]],
- [1616172000, [{"count": 18}]],
- [1616172300, [{"count": 13}]],
- [1616172600, [{"count": 17}]],
- [1616172900, [{"count": 9}]],
- [1616173200, [{"count": 9}]],
- [1616173500, [{"count": 13}]],
- [1616173800, [{"count": 11}]],
- ],
- },
-}
-
-discover_geo = {
- "seriesName": "Discover total period",
- "stats": {
- "data": [
- {"geo.country_code": "US", "count": 1},
- {"geo.country_code": "GB", "count": 30},
- {"geo.country_code": "AU", "count": 20},
- ],
- },
-}
-
-discover_total_daily = {
- "seriesName": "Discover total daily",
- "stats": {
- "data": [
- [1615852800, [{"count": 2426486}]],
- [1615939200, [{"count": 18837228}]],
- [1616025600, [{"count": 14662530}]],
- [1616112000, [{"count": 15102981}]],
- [1616198400, [{"count": 7759228}]],
- [1616284800, [{"count": 7216556}]],
- [1616371200, [{"count": 16976035}]],
- [1616457600, [{"count": 17240832}]],
- [1616544000, [{"count": 16814701}]],
- [1616630400, [{"count": 17480989}]],
- [1616716800, [{"count": 15387478}]],
- [1616803200, [{"count": 8467454}]],
- [1616889600, [{"count": 6382678}]],
- [1616976000, [{"count": 16842851}]],
- [1617062400, [{"count": 12959057}]],
- ],
- },
-}
-
-discover_total_daily_multi = {
- "seriesName": "Discover total daily",
- "stats": {
- "count()": {
- "data": [
- [1615852800, [{"count": 2426486}]],
- [1615939200, [{"count": 18837228}]],
- [1616025600, [{"count": 14662530}]],
- [1616112000, [{"count": 15102981}]],
- [1616198400, [{"count": 7759228}]],
- [1616284800, [{"count": 7216556}]],
- [1616371200, [{"count": 16976035}]],
- [1616457600, [{"count": 17240832}]],
- [1616544000, [{"count": 16814701}]],
- [1616630400, [{"count": 17480989}]],
- [1616716800, [{"count": 15387478}]],
- [1616803200, [{"count": 8467454}]],
- [1616889600, [{"count": 6382678}]],
- [1616976000, [{"count": 16842851}]],
- [1617062400, [{"count": 12959057}]],
- ],
- },
- "count_unique(user)": {
- "data": [
- [1615852800, [{"count": 242648}]],
- [1615939200, [{"count": 1883722}]],
- [1616025600, [{"count": 1466253}]],
- [1616112000, [{"count": 5102981}]],
- [1616198400, [{"count": 759228}]],
- [1616284800, [{"count": 216556}]],
- [1616371200, [{"count": 6976035}]],
- [1616457600, [{"count": 7240832}]],
- [1616544000, [{"count": 1681470}]],
- [1616630400, [{"count": 1748098}]],
- [1616716800, [{"count": 1538747}]],
- [1616803200, [{"count": 846745}]],
- [1616889600, [{"count": 382678}]],
- [1616976000, [{"count": 6842851}]],
- [1617062400, [{"count": 2959057}]],
- ],
- },
- },
-}
-
-discover_multi_y_axis = {
- "seriesName": "count()",
- "stats": {
- "count()": {
- "data": [
- (1631559900, [{"count": 5}]),
- (1631560200, [{"count": 8}]),
- (1631560500, [{"count": 10}]),
- (1631560800, [{"count": 10}]),
- (1631561100, [{"count": 6}]),
- (1631561400, [{"count": 5}]),
- (1631561700, [{"count": 7}]),
- (1631562000, [{"count": 5}]),
- (1631562300, [{"count": 6}]),
- (1631562600, [{"count": 4}]),
- (1631562900, [{"count": 8}]),
- (1631563200, [{"count": 5}]),
- (1631563500, [{"count": 5}]),
- (1631563800, [{"count": 7}]),
- (1631564100, [{"count": 5}]),
- (1631564400, [{"count": 9}]),
- (1631564700, [{"count": 5}]),
- ],
- "end": "1631646300",
- "order": "1",
- "start": "1631559900",
- },
- "count_unique(user)": {
- "data": [
- (1631559900, [{"count": 0}]),
- (1631560200, [{"count": 2}]),
- (1631560500, [{"count": 3}]),
- (1631560800, [{"count": 1}]),
- (1631561100, [{"count": 1}]),
- (1631561400, [{"count": 0}]),
- (1631561700, [{"count": 1}]),
- (1631562000, [{"count": 0}]),
- (1631562300, [{"count": 1}]),
- (1631562600, [{"count": 0}]),
- (1631562900, [{"count": 1}]),
- (1631563200, [{"count": 0}]),
- (1631563500, [{"count": 0}]),
- (1631563800, [{"count": 1}]),
- (1631564100, [{"count": 0}]),
- (1631564400, [{"count": 1}]),
- (1631564700, [{"count": 0}]),
- ],
- "end": "1631646300",
- "order": "0",
- "start": "1631559900",
- },
- },
-}
-
-discover_top5 = {
- "stats": {
- "ludic-science,1st event": {
- "data": [
- [1615877940, [{"count": 0}]],
- [1615878000, [{"count": 0}]],
- [1615878060, [{"count": 0}]],
- [1615878120, [{"count": 0}]],
- [1615878180, [{"count": 1}]],
- [1615878240, [{"count": 1}]],
- [1615878300, [{"count": 1}]],
- [1615878360, [{"count": 1}]],
- [1615878420, [{"count": 1}]],
- [1615878480, [{"count": 1}]],
- [1615878540, [{"count": 1}]],
- [1615878600, [{"count": 3}]],
- [1615878660, [{"count": 1}]],
- [1615878720, [{"count": 1}]],
- [1615878780, [{"count": 1}]],
- [1615878840, [{"count": 1}]],
- [1615878900, [{"count": 1}]],
- [1615878960, [{"count": 1}]],
- [1615879020, [{"count": 1}]],
- [1615879080, [{"count": 1}]],
- [1615879140, [{"count": 1}]],
- [1615879200, [{"count": 1}]],
- [1615879260, [{"count": 1}]],
- [1615879320, [{"count": 1}]],
- [1615879380, [{"count": 0}]],
- [1615879440, [{"count": 0}]],
- [1615879500, [{"count": 0}]],
- [1615879560, [{"count": 0}]],
- [1615879620, [{"count": 0}]],
- ],
- "order": 0,
- },
- "ludic-science,2nd event": {
- "data": [
- [1615877940, [{"count": 0}]],
- [1615878000, [{"count": 0}]],
- [1615878060, [{"count": 0}]],
- [1615878120, [{"count": 0}]],
- [1615878180, [{"count": 1}]],
- [1615878240, [{"count": 1}]],
- [1615878300, [{"count": 1}]],
- [1615878360, [{"count": 1}]],
- [1615878420, [{"count": 1}]],
- [1615878480, [{"count": 1}]],
- [1615878540, [{"count": 1}]],
- [1615878600, [{"count": 5}]],
- [1615878660, [{"count": 3}]],
- [1615878720, [{"count": 2}]],
- [1615878780, [{"count": 1}]],
- [1615878840, [{"count": 1}]],
- [1615878900, [{"count": 1}]],
- [1615878960, [{"count": 1}]],
- [1615879020, [{"count": 1}]],
- [1615879080, [{"count": 1}]],
- [1615879140, [{"count": 1}]],
- [1615879200, [{"count": 1}]],
- [1615879260, [{"count": 1}]],
- [1615879320, [{"count": 1}]],
- [1615879380, [{"count": 0}]],
- [1615879440, [{"count": 0}]],
- [1615879500, [{"count": 0}]],
- [1615879560, [{"count": 0}]],
- [1615879620, [{"count": 0}]],
- ],
- "order": 1,
- },
- "Other": {
- "data": [
- [1615877940, [{"count": 2}]],
- [1615878000, [{"count": 2}]],
- [1615878060, [{"count": 2}]],
- [1615878120, [{"count": 2}]],
- [1615878180, [{"count": 0}]],
- [1615878240, [{"count": 0}]],
- [1615878300, [{"count": 0}]],
- [1615878360, [{"count": 0}]],
- [1615878420, [{"count": 0}]],
- [1615878480, [{"count": 1}]],
- [1615878540, [{"count": 2}]],
- [1615878600, [{"count": 5}]],
- [1615878660, [{"count": 3}]],
- [1615878720, [{"count": 2}]],
- [1615878780, [{"count": 1}]],
- [1615878840, [{"count": 0}]],
- [1615878900, [{"count": 0}]],
- [1615878960, [{"count": 0}]],
- [1615879020, [{"count": 0}]],
- [1615879080, [{"count": 0}]],
- [1615879140, [{"count": 0}]],
- [1615879200, [{"count": 0}]],
- [1615879260, [{"count": 0}]],
- [1615879320, [{"count": 0}]],
- [1615879380, [{"count": 2}]],
- [1615879440, [{"count": 2}]],
- [1615879500, [{"count": 2}]],
- [1615879560, [{"count": 2}]],
- [1615879620, [{"count": 2}]],
- ],
- "order": 2,
- },
- }
-}
-
-discover_empty = {
- "seriesName": "Discover empty",
- "stats": {
- "data": [],
- },
-}
+from sentry.web.frontend.debug.mail import MailPreview
incident = {
"id": "5903779",
@@ -703,117 +430,9 @@
}
-class DebugChartRendererView(View):
+class DebugMetricAlertChartRendererView(View):
def get(self, request: HttpRequest) -> HttpResponse:
ret = []
-
- ret.append(
- {
- "chart": charts.generate_chart(
- ChartType.SLACK_DISCOVER_TOTAL_PERIOD, discover_total_period
- ),
- "title": "Slack Discover total period",
- }
- )
- ret.append(
- {
- "chart": charts.generate_chart(
- ChartType.SLACK_DISCOVER_TOTAL_PERIOD, discover_multi_y_axis
- ),
- "title": "Slack Discover total period multi y axis",
- }
- )
- ret.append(
- {
- "chart": charts.generate_chart(
- ChartType.SLACK_DISCOVER_TOTAL_PERIOD, discover_empty
- ),
- "title": "Slack Discover total period empty",
- }
- )
- ret.append(
- {
- "chart": charts.generate_chart(
- ChartType.SLACK_DISCOVER_TOTAL_DAILY, discover_total_daily
- ),
- "title": "Discover total daily",
- }
- )
- ret.append(
- {
- "chart": charts.generate_chart(
- ChartType.SLACK_DISCOVER_TOTAL_DAILY, discover_total_daily_multi
- ),
- "title": "Discover total daily multi",
- }
- )
- ret.append(
- {
- "chart": charts.generate_chart(
- ChartType.SLACK_DISCOVER_TOTAL_DAILY, discover_empty
- ),
- "title": "Discover total daily empty",
- }
- )
- ret.append(
- {
- "chart": charts.generate_chart(ChartType.SLACK_DISCOVER_TOP5_PERIOD, discover_top5),
- "title": "Slack Discover top5 period",
- }
- )
- ret.append(
- {
- "chart": charts.generate_chart(
- ChartType.SLACK_DISCOVER_TOP5_PERIOD, discover_empty
- ),
- "title": "Slack Discover top5 empty",
- }
- )
- ret.append(
- {
- "chart": charts.generate_chart(
- ChartType.SLACK_DISCOVER_TOP5_PERIOD_LINE, discover_top5
- ),
- "title": "Slack Discover top5 period line",
- }
- )
- ret.append(
- {
- "chart": charts.generate_chart(
- ChartType.SLACK_DISCOVER_TOP5_PERIOD_LINE, discover_empty
- ),
- "title": "Slack Discover top5 period line empty",
- }
- )
- ret.append(
- {
- "chart": charts.generate_chart(ChartType.SLACK_DISCOVER_TOP5_DAILY, discover_top5),
- "title": "Slack Discover top5 daily",
- }
- )
- ret.append(
- {
- "chart": charts.generate_chart(ChartType.SLACK_DISCOVER_TOP5_DAILY, discover_empty),
- "title": "Slack Discover top5 daily empty",
- }
- )
- ret.append(
- {
- "chart": charts.generate_chart(
- ChartType.SLACK_DISCOVER_PREVIOUS_PERIOD, discover_total_period
- ),
- "title": "Slack Discover previous period",
- }
- )
- ret.append(
- {
- "chart": charts.generate_chart(
- ChartType.SLACK_DISCOVER_PREVIOUS_PERIOD, discover_multi_y_axis
- ),
- "title": "Slack Discover previous period multi y axis",
- }
- )
-
ret.append(
{
"chart": charts.generate_chart(ChartType.SLACK_METRIC_ALERT_EVENTS, metric_alert),
@@ -837,4 +456,8 @@ def get(self, request: HttpRequest) -> HttpResponse:
}
)
- return render_to_response("sentry/debug/chart-renderer.html", context={"charts": ret})
+ return MailPreview(
+ html_template="sentry/debug/chart-renderer.html",
+ text_template="sentry/debug/chart-renderer.txt",
+ context={"charts": ret},
+ ).render(request)
diff --git a/tests/acceptance/chartcuterie/test_chart_renderer.py b/tests/acceptance/chartcuterie/test_chart_renderer.py
index b472b941e315db..cf38b0397ac92b 100644
--- a/tests/acceptance/chartcuterie/test_chart_renderer.py
+++ b/tests/acceptance/chartcuterie/test_chart_renderer.py
@@ -10,7 +10,7 @@ def test_debug_renders(self) -> None:
}
with self.options(options):
- self.browser.get("debug/chart-renderer/")
+ self.browser.get("debug/charts/chart-renderer/")
self.wait_for_loading()