When starting MONITOR for the first time (no prior data on disk), the hot keys fetch returns empty results even after the full monitoring duration completes. Clicking refresh immediately after shows the correct hot keys.
Root Cause:
The server waits until checkAt (set to startTime + monitoringDuration) then re-fetches hot keys from the metrics process. However, checkAt marks when collection ends in memory, not when the data is written to disk asynchronously after collectLogs returns via await onLogs(rows). The re-fetch races the disk write and reads an empty file.
Fix:
Add a 1-second buffer to the server-side delay after checkAt. The actual write overhead is ~50ms for typical cycles, so 1 second provides 20x margin.
When starting MONITOR for the first time (no prior data on disk), the hot keys fetch returns empty results even after the full monitoring duration completes. Clicking refresh immediately after shows the correct hot keys.
Root Cause:
The server waits until checkAt (set to startTime + monitoringDuration) then re-fetches hot keys from the metrics process. However, checkAt marks when collection ends in memory, not when the data is written to disk asynchronously after collectLogs returns via await onLogs(rows). The re-fetch races the disk write and reads an empty file.
Fix:
Add a 1-second buffer to the server-side delay after checkAt. The actual write overhead is ~50ms for typical cycles, so 1 second provides 20x margin.