diff --git a/src/sentry/utils/sdk_crashes/event_stripper.py b/src/sentry/utils/sdk_crashes/event_stripper.py index c227a4ad6d2c..0e95b67e62d9 100644 --- a/src/sentry/utils/sdk_crashes/event_stripper.py +++ b/src/sentry/utils/sdk_crashes/event_stripper.py @@ -102,6 +102,19 @@ def with_explanation(self, explanation: str) -> "Allow": "version": Allow.SIMPLE_TYPE, "build": Allow.SIMPLE_TYPE, }, + "art": { + "gc.total_count": Allow.SIMPLE_TYPE, + "gc.total_time": Allow.SIMPLE_TYPE, + "gc.blocking_count": Allow.SIMPLE_TYPE, + "gc.blocking_time": Allow.SIMPLE_TYPE, + "gc.pre_oome_count": Allow.SIMPLE_TYPE, + "gc.waiting_time": Allow.SIMPLE_TYPE, + "memory.free": Allow.SIMPLE_TYPE, + "memory.free_until_gc": Allow.SIMPLE_TYPE, + "memory.free_until_oome": Allow.SIMPLE_TYPE, + "memory.total": Allow.SIMPLE_TYPE, + "memory.max": Allow.SIMPLE_TYPE, + }, }, } diff --git a/tests/sentry/utils/sdk_crashes/test_event_stripper.py b/tests/sentry/utils/sdk_crashes/test_event_stripper.py index 295c9cb6c3d7..eea65bd07dfc 100644 --- a/tests/sentry/utils/sdk_crashes/test_event_stripper.py +++ b/tests/sentry/utils/sdk_crashes/test_event_stripper.py @@ -94,6 +94,48 @@ def test_strip_event_data_strips_context(store_and_strip_event) -> None: } +@django_db_all +@pytest.mark.snuba +def test_strip_event_data_keeps_art_context(store_and_strip_event) -> None: + """ART (Android Runtime) memory and GC context from ANR thread dumps must survive stripping.""" + event_data = get_crash_event() + set_path( + event_data, + "contexts", + "art", + value={ + "gc.total_count": 42, + "gc.total_time": 123.4, + "gc.blocking_count": 5, + "gc.blocking_time": 50.1, + "gc.pre_oome_count": 1, + "gc.waiting_time": 10.0, + "memory.free": 1024, + "memory.free_until_gc": 2048, + "memory.free_until_oome": 512, + "memory.total": 4096, + "memory.max": 8192, + "some_private_field": "should_be_stripped", + }, + ) + + stripped_event_data = store_and_strip_event(data=event_data) + + assert stripped_event_data["contexts"]["art"] == { + "gc.total_count": 42, + "gc.total_time": 123.4, + "gc.blocking_count": 5, + "gc.blocking_time": 50.1, + "gc.pre_oome_count": 1, + "gc.waiting_time": 10.0, + "memory.free": 1024, + "memory.free_until_gc": 2048, + "memory.free_until_oome": 512, + "memory.total": 4096, + "memory.max": 8192, + } + + @django_db_all @pytest.mark.snuba def test_strip_event_data_strips_sdk(store_and_strip_event) -> None: