Skip to content

Hot keys returns empty on first MONITOR cycle due to disk write race #433

Description

@ravjotbrar

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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions