Skip to content

Commit 6e94491

Browse files
Abdkhan14Abdullah Khan
andauthored
feat(source-map-issues): Adding group id and title as attr to processing error trace item (#112387)
- The sample events should be links that take us to the corresponding issue details - Sending title and group id as attributes so that we don't have to - - 1) fetch the trace items for the event_ids and then - - 2) fetch the full events using the event details endpoints <img width="693" height="384" alt="Screenshot 2026-04-07 at 11 49 57 PM" src="https://github.com/user-attachments/assets/7e351577-af8e-447c-a4d4-5af0a77b8bd1" /> --------- Co-authored-by: Abdullah Khan <abdullahkhan@PG9Y57YDXQ.local>
1 parent c97b218 commit 6e94491

File tree

4 files changed

+32
-2
lines changed

4 files changed

+32
-2
lines changed

src/sentry/processing_errors/eap/producer.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ def produce_processing_errors_to_eap(
4444
project: Project,
4545
event_data: Mapping[str, Any],
4646
processing_errors: Sequence[Mapping[str, Any]],
47+
group_id: int | None = None,
48+
title: str | None = None,
4749
) -> None:
4850
"""
4951
Produces processing errors as TraceItems to the EAP topic.
@@ -99,6 +101,12 @@ def produce_processing_errors_to_eap(
99101
if sdk_version is not None:
100102
attributes["sdk_version"] = sdk_version
101103

104+
if title is not None:
105+
attributes["title"] = title
106+
107+
if group_id is not None:
108+
attributes["group_id"] = group_id
109+
102110
item_id = hex_to_item_id(
103111
uuid.uuid5(PROCESSING_ERROR_NAMESPACE, f"{event_data['event_id']}:{index}").hex
104112
)

src/sentry/search/eap/processing_errors/attributes.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,15 @@
5555
internal_name="sdk_version",
5656
search_type="string",
5757
),
58+
ResolvedAttribute(
59+
public_alias="title",
60+
internal_name="title",
61+
search_type="string",
62+
),
63+
ResolvedAttribute(
64+
public_alias="group_id",
65+
internal_name="group_id",
66+
search_type="integer",
67+
),
5868
]
5969
}

src/sentry/tasks/post_process.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1277,7 +1277,9 @@ def process_processing_errors_eap(job: PostProcessJob) -> None:
12771277

12781278
from sentry.processing_errors.eap.producer import produce_processing_errors_to_eap
12791279

1280-
produce_processing_errors_to_eap(event.project, event.data, processing_errors)
1280+
produce_processing_errors_to_eap(
1281+
event.project, event.data, processing_errors, group_id=event.group_id, title=event.title
1282+
)
12811283

12821284

12831285
def process_processing_issue_detection(job: PostProcessJob) -> None:

tests/sentry/processing_errors/eap/test_producer.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,13 @@ def test_optional_fields_included_when_present(self, mock_get_topic, mock_produc
107107
)
108108
errors = [{"type": "js_no_source", "symbolicator_type": "missing_sourcemap"}]
109109

110-
produce_processing_errors_to_eap(self.project, event_data, errors)
110+
produce_processing_errors_to_eap(
111+
self.project,
112+
event_data,
113+
errors,
114+
group_id=12345,
115+
title="ReferenceError: undefined variable",
116+
)
111117

112118
payload = mock_producer.produce.call_args[0][1]
113119
trace_item = codec.decode(payload.value)
@@ -117,6 +123,8 @@ def test_optional_fields_included_when_present(self, mock_get_topic, mock_produc
117123
assert trace_item.attributes["platform"].string_value == "javascript"
118124
assert trace_item.attributes["sdk_name"].string_value == "sentry.javascript.browser"
119125
assert trace_item.attributes["sdk_version"].string_value == "7.0.0"
126+
assert trace_item.attributes["title"].string_value == "ReferenceError: undefined variable"
127+
assert trace_item.attributes["group_id"].int_value == 12345
120128

121129
@patch("sentry.processing_errors.eap.producer._eap_producer")
122130
@patch("sentry.processing_errors.eap.producer.get_topic_definition")
@@ -138,6 +146,8 @@ def test_optional_fields_omitted_when_absent(self, mock_get_topic, mock_producer
138146
assert "sdk_name" not in trace_item.attributes
139147
assert "sdk_version" not in trace_item.attributes
140148
assert "symbolicator_type" not in trace_item.attributes
149+
assert "title" not in trace_item.attributes
150+
assert "group_id" not in trace_item.attributes
141151

142152
@patch("sentry.processing_errors.eap.producer.logger")
143153
@patch("sentry.processing_errors.eap.producer._eap_producer")

0 commit comments

Comments
 (0)