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

Healthchecks does not use the timezone of the container #975

Open
strboul opened this issue Mar 17, 2024 · 2 comments
Open

Healthchecks does not use the timezone of the container #975

strboul opened this issue Mar 17, 2024 · 2 comments

Comments

@strboul
Copy link

strboul commented Mar 17, 2024

Hello,

I have the container, which its TZ is set to Europe/Amsterdam, but Healthcheck just gives me the UTC. Therefore I have 1 hour difference between the timestamps of pings.

I'm aware that on the Events page of a check, there's a select between UTC and Browser's time zone but I'd still like to see the TZ of my servers on the ping modal directly.

Setting up TIME_ZONE = "Europe/Amsterdam" in local_settings.py made the timezone correct but only in the Django Admin, not the UI.

I'm not sure if this is a bug or just a feature (because there can be multiple servers with different timezones?) still it'd be nice to give a default TZ option to users whose servers are in just one TZ.


On the UI:

2024-03-17_13-26

sqlite:

select * from api_ping order by created desc limit 1;
# 62855|10.10.10.186|GET|curl/7.81.0|35|http|1|||2024-03-17 12:26:18.917484||||

container:

root@53303d81bd0c:/# date
# Sun Mar 17 13:28:15 CET 2024
root@53303d81bd0c:/# echo $TZ
# Europe/Amsterdam
root@53303d81bd0c:/# cat /etc/timezone
# cat: /etc/timezone: No such file or directory
root@53303d81bd0c:/# cat /etc/localtime
# cat: /etc/localtime: No such file or directory

On browser:

Intl.DateTimeFormat().resolvedOptions().timeZone
// "Europe/Amsterdam"

Healthcheck version:

3.2

Thanks for developing Healthchecks again ❤️

@cuu508
Copy link
Member

cuu508 commented Mar 20, 2024

Healthchecks is designed as a multi-user system, the different users can of course be in different timezones. Using the server's timezone as the default would make one subset of the users happy, and all the rest unhappy.

It seems the issue here is the "Ping Details" modal only shows the time as an ISO8601 timestamp only, and does not show the formatted version in local timezone. Suppose the "Time Received" field had two values – the timestamp, and also a formatted version (formatted using the browser's timezone) – would that work better?

@strboul
Copy link
Author

strboul commented Mar 21, 2024

Healthchecks is designed as a multi-user system, the different users can of course be in different timezones.

That makes sense but the Ping Details timestamp shows the UTC time that's in neither browser nor server. So UTC is chosen to be the static default for all cases but instead of timestamp with the server timezone.

Suppose the "Time Received" field had two values – the timestamp, and also a formatted version (formatted using the browser's timezone) – would that work better?

Sounds like a good idea. I'm not sure how'd you like to call those fields. Maybe make the current Time Received formatted using the browser's timezone and add a new field called Server Time Received showing the server timestamp.

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

No branches or pull requests

2 participants