Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure all JSON timestamps use UTC time #1335

Merged
merged 2 commits into from
Feb 18, 2025
Merged

Ensure all JSON timestamps use UTC time #1335

merged 2 commits into from
Feb 18, 2025

Conversation

mbarnes
Copy link
Collaborator

@mbarnes mbarnes commented Feb 15, 2025

What this PR does

Did a quick audit of the RP code to make sure all timestamps that appear in JSON data - whether for logging or response bodies - use UTC time. Found one case to fix and one case to remove.

@venkateshsredhat
Copy link
Collaborator

@mbarnes There's a CI failure .

@mbarnes
Copy link
Collaborator Author

mbarnes commented Feb 17, 2025

Appears to be a service lifecycle issue, unrelated to the changes here. But I'll rerun the jobs.

Matthew Barnes added 2 commits February 17, 2025 12:55
Caught this using local time instead of UTC time. But on further
inspection, RequestTime is not being used anywhere in the frontend;
not for logging nor for metrics.

I think this was a carryover from ARO-RP so remove it.
@hbhushan3
Copy link
Collaborator

Based on a quick search in the repo, I see time.Now() being used in 10 files. Can we switch to time.Now().UTC() in all these files or probably create a ticket to look into this? Thanks.

@mbarnes
Copy link
Collaborator Author

mbarnes commented Feb 17, 2025

Based on a quick search in the repo, I see time.Now() being used in 10 files. Can we switch to time.Now().UTC() in all these files or probably create a ticket to look into this? Thanks.

All those other cases are used as timers. You'll see they're each followed shortly by a time.Since call to get a duration. The time value itself does not appear in any output: HTTP responses, logs, metrics, etc. So the time.UTC call isn't needed for those cases.

Copy link
Collaborator

@hbhushan3 hbhushan3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve /lgtm

@mbarnes mbarnes merged commit 73ba561 into main Feb 18, 2025
21 checks passed
@mbarnes mbarnes deleted the utc-timestamps branch February 18, 2025 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants