Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: avoid truncating sessionaction logs
Summary: In the service we use a SessionAction's reported startedAt/endedAt time to filter the cloudwatch logs stream for a Session so that we can display only the logs relevant to that particular SessionAction. There is an edge case that occationally shows up where the very last log line of a SessionAction will not show up in this filtered view. This is because the timestamp on that log line is *after* the endedAt time of the SessionAction; see below for a sample: In the portal UI I only see the following in the sync attachments log: ``` 2023/11/02 13:29:10-05:00 Syncing inputs using Job Attachments 2023/11/02 13:29:11-05:00 Downloaded 445.0 B / 445.0 B of 1 file (Transfer rate: 0.0 B/s) ``` The full log shows: ``` 2023-11-02T13:29:10.839-05:00 Syncing inputs using Job Attachments 2023-11-02T13:29:11.042-05:00 Downloaded 445.0 B / 445.0 B of 1 file (Transfer rate: 0.0 B/s) 2023-11-02T13:29:11.044-05:00 Summary Statistics for file downloads: Processed 1 file totaling 445.0 B. Skipped re-processing 0 files totaling 0.0 B. Total processing time of 0.05191 seconds at 8.57 KB/s. ``` The session action details are: ``` % aws deadline get-session-action --farm-id ... { "sessionActionId": "sessionaction-d0f37f306f93484699ceda74bb6c15ef-0", "status": "SUCCEEDED", "startedAt": "2023-11-02T18:29:10.838000+00:00", "endedAt": "2023-11-02T18:29:11.043000+00:00", "progressPercent": 100.0, "sessionId": "session-d0f37f306f93484699ceda74bb6c15ef", "definition": { "syncInputJobAttachments": {} } } ``` Notice that the timestamp on the line of logging that's excluded is 1 millisecond after the endedAt time of the SessionAction. Resolution: This comes down to a difference in rounding. We are rounding when converting a timestamp in to the integer number of milliseconds after epoch-utc to report to CloudWatch. However, the Deadline Cloud service is truncating the startedAt/endedAt times to the number of milliseconds. Truncation and rounding produce different results half of the time (statistically speaking). So, this fix modifies the timestamp that we report to CloudWatch to truncate to the number of milliseconds rather than round. Signed-off-by: Daniel Neilson <53624638+ddneilson@users.noreply.github.com>
- Loading branch information