Skip to content

Commit 59b5699

Browse files
feat(insights): Updates Web Vital Issue detection titles (#103657)
Updates the titles for web vital issues
1 parent 9010524 commit 59b5699

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/sentry/web_vitals/issue_platform_adapter.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,13 @@ def send_web_vitals_issue_to_platform(data: WebVitalIssueGroupData, trace_id: st
6868

6969
# TODO: Add better titles and subtitles
7070
if data["vital_grouping"] == "rendering":
71-
title = "Render time Web Vital scores need improvement"
71+
title = f"The page {transaction} was slow to load and render"
72+
elif data["vital_grouping"] == "cls":
73+
title = f"The page {transaction} had layout shifts while loading"
74+
elif data["vital_grouping"] == "inp":
75+
title = f"The page {transaction} responded slowly to user interactions"
7276
else:
73-
title = f"{data['vital_grouping'].upper()} score needs improvement"
77+
raise ValueError(f"Invalid vital grouping: {data['vital_grouping']}")
7478
subtitle_parts = []
7579
for vital in data["scores"]:
7680
a_or_an = "an" if vital in ("lcp", "fcp", "inp") else "a"

tests/sentry/tasks/test_web_vitals_issue_detection.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def test_run_detection_produces_occurrences(self, mock_produce_occurrence_to_kaf
231231
lcp_call = call_args_list[0]
232232
lcp_occurrence = lcp_call.kwargs["occurrence"]
233233
assert lcp_occurrence.fingerprint == ["d94185e6d794589212c74476702515734b703f86"]
234-
assert lcp_occurrence.issue_title == "Render time Web Vital scores need improvement"
234+
assert lcp_occurrence.issue_title == "The page /home was slow to load and render"
235235
assert (
236236
lcp_occurrence.subtitle == "/home has an LCP score of 0.5 and an FCP score of 0.8"
237237
)
@@ -242,7 +242,9 @@ def test_run_detection_produces_occurrences(self, mock_produce_occurrence_to_kaf
242242
inp_call = call_args_list[1]
243243
inp_occurrence = inp_call.kwargs["occurrence"]
244244
assert inp_occurrence.fingerprint == ["d8b421cb6e5476121654d1383e80f4515a7f58b9"]
245-
assert inp_occurrence.issue_title == "INP score needs improvement"
245+
assert (
246+
inp_occurrence.issue_title == "The page /home responded slowly to user interactions"
247+
)
246248
assert inp_occurrence.subtitle == "/home has an INP score of 0.85"
247249
inp_event_data = inp_call.kwargs["event_data"]
248250
assert inp_event_data["tags"]["inp_score"] == "0.85"
@@ -347,7 +349,7 @@ def test_run_detection_groups_rendering_vitals(self, mock_produce_occurrence_to_
347349
lcp_call = call_args_list[0]
348350
lcp_occurrence = lcp_call.kwargs["occurrence"]
349351
assert lcp_occurrence.fingerprint == ["d94185e6d794589212c74476702515734b703f86"]
350-
assert lcp_occurrence.issue_title == "Render time Web Vital scores need improvement"
352+
assert lcp_occurrence.issue_title == "The page /home was slow to load and render"
351353
assert (
352354
lcp_occurrence.subtitle
353355
== "/home has an LCP score of 0.5, an FCP score of 0.8 and a TTFB score of 0.6"

0 commit comments

Comments
 (0)