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
13 changes: 13 additions & 0 deletions src/sentry/utils/sdk_crashes/event_stripper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
},
}

Expand Down
42 changes: 42 additions & 0 deletions tests/sentry/utils/sdk_crashes/test_event_stripper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading