Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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: 8 additions & 0 deletions src/sentry/processing_errors/eap/producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def produce_processing_errors_to_eap(
project: Project,
event_data: Mapping[str, Any],
processing_errors: Sequence[Mapping[str, Any]],
group_id: int | None = None,
title: str | None = None,
) -> None:
"""
Produces processing errors as TraceItems to the EAP topic.
Expand Down Expand Up @@ -99,6 +101,12 @@ def produce_processing_errors_to_eap(
if sdk_version is not None:
attributes["sdk_version"] = sdk_version

if title is not None:
attributes["title"] = title

if group_id is not None:
attributes["group_id"] = str(group_id)
Comment thread
cursor[bot] marked this conversation as resolved.
Outdated

item_id = hex_to_item_id(
uuid.uuid5(PROCESSING_ERROR_NAMESPACE, f"{event_data['event_id']}:{index}").hex
)
Expand Down
10 changes: 10 additions & 0 deletions src/sentry/search/eap/processing_errors/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,15 @@
internal_name="sdk_version",
search_type="string",
),
ResolvedAttribute(
public_alias="title",
internal_name="title",
search_type="string",
),
ResolvedAttribute(
public_alias="group_id",
internal_name="group_id",
search_type="string",
),
Comment thread
cursor[bot] marked this conversation as resolved.
]
}
4 changes: 3 additions & 1 deletion src/sentry/tasks/post_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -1277,7 +1277,9 @@ def process_processing_errors_eap(job: PostProcessJob) -> None:

from sentry.processing_errors.eap.producer import produce_processing_errors_to_eap

produce_processing_errors_to_eap(event.project, event.data, processing_errors)
produce_processing_errors_to_eap(
event.project, event.data, processing_errors, group_id=event.group_id, title=event.title
)
Comment on lines +1280 to +1282

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the group id should already be available in the occurrence data, are you sure that you need this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wedamija We'd have the source map issue's group_id in the occurrence data, instead of the the group_id of the sample events that triggered detection



def process_processing_issue_detection(job: PostProcessJob) -> None:
Expand Down
12 changes: 11 additions & 1 deletion tests/sentry/processing_errors/eap/test_producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,13 @@ def test_optional_fields_included_when_present(self, mock_get_topic, mock_produc
)
errors = [{"type": "js_no_source", "symbolicator_type": "missing_sourcemap"}]

produce_processing_errors_to_eap(self.project, event_data, errors)
produce_processing_errors_to_eap(
self.project,
event_data,
errors,
group_id=12345,
title="ReferenceError: undefined variable",
)

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

@patch("sentry.processing_errors.eap.producer._eap_producer")
@patch("sentry.processing_errors.eap.producer.get_topic_definition")
Expand All @@ -138,6 +146,8 @@ def test_optional_fields_omitted_when_absent(self, mock_get_topic, mock_producer
assert "sdk_name" not in trace_item.attributes
assert "sdk_version" not in trace_item.attributes
assert "symbolicator_type" not in trace_item.attributes
assert "title" not in trace_item.attributes
assert "group_id" not in trace_item.attributes

@patch("sentry.processing_errors.eap.producer.logger")
@patch("sentry.processing_errors.eap.producer._eap_producer")
Expand Down
Loading