Stratkit Crash Tracking¶
Crash Tracking System¶
This package tracks client session activity and reports crash-recovery events through the Bytro tracking pipeline.
It is based on CrashTrackingTool.js from the legacy Supremacy game.
What Is Tracked¶
CrashTrackingSystem (Persistent World) maintains a SessionLog with:
userId- session open time
- last actions (newest first)
- scenario ID
- day of game
- beta level
- memory snapshot from last action
- client version
Runtime Flow¶
- On startup, the system reads the previous
SessionLogfromPlayerPrefs(crashTrackingLog). - If the previous log exists and its last action is not
close, aCrashRecoveredEventis emitted. - That event is serialized with
CrashRecoveredEventSerializerand sent byBytroTrackingHandlerto:https://event-ingest.bytro.com/event - The previous stored log is removed, and a new session starts once required data is available.
- During runtime, every session action updates and saves
SessionLogtoPlayerPrefs. - On normal shutdown (
OnDestroy), a finalcloseaction is written.
Action Logging¶
To add an action, trigger:
LogSessionActionRequest.Trigger(EntityManager em, string actionName)
Notes:
- Prefer names from
SessionActionName; add new names there if needed. - Actions can be triggered from both Persistent and Map worlds.
CrashTrackingSessionActionBridgeSystemforwards map-world actions toCrashTrackingSystem.- Consider creating an adapter implementing
IApplicationMonitorAdapterfromcom.stratkit.core.application-monitoringand triggering log requests from there usingTrackSessionEvent(string eventPayload)method.
Behavior Notes¶
- Only the latest
20actions are stored (MaxActions = 20), but we're only sending the last2. It's a direct copy of the legacy game behavior. - Action timestamps use elapsed in-session time (
timeSinceOpen), in milliseconds. - Memory is sampled on each action (
TotalHeapSize,UsedHeapSize,SystemMemoryBytes).