Instrument edit events (#4006)
The goal of this PR is to send up events that contain the duration of keyboard activity within Zed. I built the `EventCoalescer`, which gets called called each time a key is pressed, within any environment (in the case of this PR, within "editor" and "terminal). The" `EventCoalescer` holds a start and end DateTime and adjusts the end instant as events come in, until a timeout from the last event is hit. I did my best to keep this mechanism efficient (avoiding vectors to store moments in time, avoiding spawning timers threads, etc.), because I know this is going to be per keystroke, but its behind a lock on the telemetry struck, since it has to know when the environment changes, in which point, it will automatically end the activity period, even if there is no timeout. Because we have to have access to it from different parts of the system, we have to go through the lock, which worried me a bit (@mikayla-maki's intuition is that it should be fine). As for the event, I take the time between the durations reported by the event coalescer and send that up to zed - the indention is to reconstruct the start and end times on zed.dev, in the same way we use the event offset times and the time on zed.dev to get the official event timestamp, and avoid the issue of the user having their system clocks set wrong. I'd really appreciate it if @nathansobo or @maxbrunsfeld could check this out. Release Notes: - N/A
J
Joseph T. Lyons committed
75cb409d2ed4684d65f341c1230350bfe571b7b8
Committed by GitHub <noreply@github.com>
on 1/11/2024, 1:19:29 PM