@@ -258,3 +258,66 @@ How long it took from when the user stopped pressing a key to when they were sho
258258 rHandler->>User: add to already shown results
259259 end
260260```
261+
262+ ## Crash Monitoring
263+
264+ We make an attempt to gather information regarding when the IDE crashes. This is the diagram of the steps that take place.
265+
266+ ## Sequence Diagram
267+
268+ ` Crash Monitoring ` : The "service" that allows us to detect and react to crashes
269+
270+ ` Heartbeat ` : Sends heartbeats which signal that the extension is still running and has not crashed
271+
272+ ` Crash Checker ` : Observes the heartbeats, reporting a telemetry event if a crash is detected
273+
274+ ` File System State ` : The user's file system that we store our heartbeat state
275+
276+ ``` mermaid
277+ %%{init: {'theme':'default'}}%%
278+ sequenceDiagram
279+ autonumber
280+
281+ participant VSC as VS Code
282+ participant Monitoring as Crash Monitoring
283+ participant Checker as Crash Checker
284+ participant Heartbeat as Heartbeat
285+ participant State as File System State
286+
287+ rect rgb(121, 210, 121)
288+ alt Extension Startup
289+ VSC ->> Monitoring: activate() - Start Monitoring
290+
291+ Monitoring ->> Heartbeat: Start Heartbeats
292+ Heartbeat ->> State: Send Initial Heartbeat <br/> (write a file w/ timestamp)
293+ rect rgb(64, 191, 64)
294+ par every 5 minutes
295+ Heartbeat ->> State: Send Heartbeat <br/> (overwrite file w/ new timestamp)
296+ end
297+ end
298+
299+ Monitoring ->> Checker: Start Crash Checking
300+ rect rgb(64, 191, 64)
301+ par every 10 minutes
302+ Checker ->> Checker: If computer went to sleep, skip this iteration
303+ Checker ->> State: Request all heartbeat timestamps
304+ State ->> Checker: Get all heartbeat timestamps
305+ loop for each timestamp stale by >= 10 minutes
306+ Checker ->> State: Delete heartbeat file
307+ Checker ->> Checker: Send crash metric: session_end
308+ end
309+ end
310+ end
311+ end
312+ end
313+
314+ rect rgb(255, 128, 128)
315+ alt Graceful Shutdown
316+ VSC ->> Monitoring: deactivate() - Stop Monitoring
317+ Monitoring ->> Checker: Stop
318+ Monitoring ->> Heartbeat: Stop
319+ Heartbeat ->> State: Delete timestamp file <br/> (This is missed when a crash happens)
320+ end
321+ end
322+
323+ ```
0 commit comments