Skip to content

Commit 93f3fd9

Browse files
authored
feat(Unity): Add Unity context type tag mapping (#104956)
1 parent f972dc7 commit 93f3fd9

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

src/sentry/interfaces/contexts.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,15 @@ class OtelContextType(ContextType):
236236
context_to_tag_mapping = {}
237237

238238

239+
@contexttype
240+
class UnityContextType(ContextType):
241+
type = "unity"
242+
context_to_tag_mapping = {
243+
"is_main_thread": "{is_main_thread}",
244+
"install_mode": "{install_mode}",
245+
}
246+
247+
239248
class Contexts(Interface):
240249
"""
241250
This interface stores context specific information.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
source: tests/sentry/event_manager/interfaces/test_contexts.py
3+
---
4+
errors: null
5+
tags:
6+
- - unity.install_mode
7+
- Store
8+
- - unity.is_main_thread
9+
- 'yes'
10+
to_json:
11+
unity:
12+
active_scene_name: MainScene
13+
editor_version: 2022.3.1f1
14+
install_mode: Store
15+
is_main_thread: true
16+
rendering_threading_mode: MultiThreaded
17+
target_frame_rate: '60'
18+
type: unity

tests/sentry/event_manager/interfaces/test_contexts.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,18 @@ def test_large_nested_numbers() -> None:
183183
"type": "default",
184184
}
185185
assert ctx_data == expected_data
186+
187+
188+
def test_unity(make_ctx_snapshot) -> None:
189+
make_ctx_snapshot(
190+
{
191+
"unity": {
192+
"active_scene_name": "MainScene",
193+
"editor_version": "2022.3.1f1",
194+
"install_mode": "Store",
195+
"is_main_thread": True,
196+
"rendering_threading_mode": "MultiThreaded",
197+
"target_frame_rate": "60",
198+
}
199+
}
200+
)

0 commit comments

Comments
 (0)