Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/sentry/web_vitals/issue_platform_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,13 @@ def send_web_vitals_issue_to_platform(data: WebVitalIssueGroupData, trace_id: st

# TODO: Add better titles and subtitles
if data["vital_grouping"] == "rendering":
title = "Render time Web Vital scores need improvement"
title = f"The page {transaction} was slow to load and render"
elif data["vital_grouping"] == "cls":
title = f"The page {transaction} had layout shifts while loading"
elif data["vital_grouping"] == "inp":
title = f"The page {transaction} responded slowly to user interactions"
else:
title = f"{data['vital_grouping'].upper()} score needs improvement"
raise ValueError(f"Invalid vital grouping: {data['vital_grouping']}")
subtitle_parts = []
for vital in data["scores"]:
a_or_an = "an" if vital in ("lcp", "fcp", "inp") else "a"
Expand Down
8 changes: 5 additions & 3 deletions tests/sentry/tasks/test_web_vitals_issue_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def test_run_detection_produces_occurrences(self, mock_produce_occurrence_to_kaf
lcp_call = call_args_list[0]
lcp_occurrence = lcp_call.kwargs["occurrence"]
assert lcp_occurrence.fingerprint == ["d94185e6d794589212c74476702515734b703f86"]
assert lcp_occurrence.issue_title == "Render time Web Vital scores need improvement"
assert lcp_occurrence.issue_title == "The page /home was slow to load and render"
assert (
lcp_occurrence.subtitle == "/home has an LCP score of 0.5 and an FCP score of 0.8"
)
Expand All @@ -242,7 +242,9 @@ def test_run_detection_produces_occurrences(self, mock_produce_occurrence_to_kaf
inp_call = call_args_list[1]
inp_occurrence = inp_call.kwargs["occurrence"]
assert inp_occurrence.fingerprint == ["d8b421cb6e5476121654d1383e80f4515a7f58b9"]
assert inp_occurrence.issue_title == "INP score needs improvement"
assert (
inp_occurrence.issue_title == "The page /home responded slowly to user interactions"
)
assert inp_occurrence.subtitle == "/home has an INP score of 0.85"
inp_event_data = inp_call.kwargs["event_data"]
assert inp_event_data["tags"]["inp_score"] == "0.85"
Expand Down Expand Up @@ -347,7 +349,7 @@ def test_run_detection_groups_rendering_vitals(self, mock_produce_occurrence_to_
lcp_call = call_args_list[0]
lcp_occurrence = lcp_call.kwargs["occurrence"]
assert lcp_occurrence.fingerprint == ["d94185e6d794589212c74476702515734b703f86"]
assert lcp_occurrence.issue_title == "Render time Web Vital scores need improvement"
assert lcp_occurrence.issue_title == "The page /home was slow to load and render"
assert (
lcp_occurrence.subtitle
== "/home has an LCP score of 0.5, an FCP score of 0.8 and a TTFB score of 0.6"
Expand Down
Loading