File tree Expand file tree Collapse file tree 4 files changed +18
-2
lines changed
Expand file tree Collapse file tree 4 files changed +18
-2
lines changed Original file line number Diff line number Diff line change 2020from sentry .models import EventDict
2121from sentry .snuba .events import Column , Columns
2222from sentry .spans .grouping .api import load_span_grouping_config
23+ from sentry .types .issues import GROUP_TYPE_TO_TEXT , GroupCategory
2324from sentry .utils import json
2425from sentry .utils .cache import memoize
2526from sentry .utils .canonical import CanonicalKeyView
@@ -495,6 +496,8 @@ def get_email_subject(self) -> str:
495496 template = self .project .get_option ("mail:subject_template" )
496497 if template :
497498 template = EventSubjectTemplate (template )
499+ elif self .group .issue_category == GroupCategory .PERFORMANCE :
500+ template = EventSubjectTemplate ("$shortID - $issueType" )
498501 else :
499502 template = DEFAULT_SUBJECT_TEMPLATE
500503 return cast (
@@ -753,6 +756,8 @@ def __getitem__(self, name: str) -> str:
753756 return cast (str , self .event .organization .slug )
754757 elif name == "title" :
755758 return self .event .title
759+ elif name == "issueType" :
760+ return cast (str , GROUP_TYPE_TO_TEXT .get (self .event .group .issue_type , "Issue" ))
756761 raise KeyError
757762
758763
Original file line number Diff line number Diff line change @@ -29,6 +29,17 @@ class GroupCategory(Enum):
2929 GroupType .PERFORMANCE_N_PLUS_ONE_DB_QUERIES : GroupCategory .PERFORMANCE ,
3030}
3131
32+ GROUP_TYPE_TO_TEXT = {
33+ GroupType .ERROR : "Error" ,
34+ GroupType .PERFORMANCE_N_PLUS_ONE : "N+1 Query" ,
35+ GroupType .PERFORMANCE_SLOW_SPAN : "Slow Span" ,
36+ GroupType .PERFORMANCE_SEQUENTIAL_SLOW_SPANS : "Sequential Slow Spans" ,
37+ GroupType .PERFORMANCE_LONG_TASK_SPANS : "Long Task Spans" ,
38+ GroupType .PERFORMANCE_RENDER_BLOCKING_ASSET_SPAN : "Render Blocking Asset Span" ,
39+ GroupType .PERFORMANCE_DUPLICATE_SPANS : "Duplicate Spans" ,
40+ GroupType .PERFORMANCE_N_PLUS_ONE_DB_QUERIES : "N+1 DB Queries" ,
41+ }
42+
3243
3344def get_category_type_mapping ():
3445 category_type_mapping = defaultdict (list )
Original file line number Diff line number Diff line change @@ -186,7 +186,7 @@ def test_full_integration_performance(self):
186186 assert len (mail .outbox ) == 1
187187 sent = mail .outbox [0 ]
188188 assert sent .to == [self .user .email ]
189- assert "/country_by_code/ " in sent .subject
189+ assert "N+1 DB Queries " in sent .subject
190190
191191 # XXX(gilbert): remove this later one
192192 @mock .patch ("sentry.mail.actions.determine_eligible_recipients" )
Original file line number Diff line number Diff line change @@ -311,7 +311,7 @@ def test_simple_notification_perf(self):
311311 self .adapter .notify (notification , ActionTargetType .ISSUE_OWNERS )
312312
313313 msg = mail .outbox [0 ]
314- assert msg .subject == "[Sentry] BAR-1 - /books/ "
314+ assert msg .subject == "[Sentry] BAR-1 - N+1 DB Queries "
315315 checked_values = [
316316 "Transaction Name" ,
317317 # TODO: Not sure if this is right
You can’t perform that action at this time.
0 commit comments