Skip to content

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

  1. On startup, the system reads the previous SessionLog from PlayerPrefs (crashTrackingLog).
  2. If the previous log exists and its last action is not close, a CrashRecoveredEvent is emitted.
  3. That event is serialized with CrashRecoveredEventSerializer and sent by BytroTrackingHandler to: https://event-ingest.bytro.com/event
  4. The previous stored log is removed, and a new session starts once required data is available.
  5. During runtime, every session action updates and saves SessionLog to PlayerPrefs.
  6. On normal shutdown (OnDestroy), a final close action 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.
  • CrashTrackingSessionActionBridgeSystem forwards map-world actions to CrashTrackingSystem.
  • Consider creating an adapter implementing IApplicationMonitorAdapter from com.stratkit.core.application-monitoring and triggering log requests from there using TrackSessionEvent(string eventPayload) method.

Behavior Notes

  • Only the latest 20 actions are stored (MaxActions = 20), but we're only sending the last 2. 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).