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

Add NTP support #19189

Open
MadMaxInfinity opened this issue May 6, 2022 · 5 comments
Open

Add NTP support #19189

MadMaxInfinity opened this issue May 6, 2022 · 5 comments
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.

Comments

@MadMaxInfinity
Copy link

Summary

Currently, matomo uses the server’s time.
But analytics would be more accurate if they are synced through NTP, and TOTP would be more resilient (read this to get why this is interesting) if matomo would manage a NTP setting and use it.
This can have other interests I don’t think of right now, so if others want to reply.

Your Environment

  • Matomo Version: 4.9.1
  • PHP Version: Not relevant
  • Server Operating System: Not relevant
  • Additionally installed plugins: Not relevant
@MadMaxInfinity MadMaxInfinity added the Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. label May 6, 2022
@MatomoForumNotifications

This issue has been mentioned on Matomo forums. There might be relevant details there:

https://forum.matomo.org/t/add-ntp-support/45832/3

@sgiehl
Copy link
Member

sgiehl commented May 8, 2022

Hi @MadMaxInfinity,
Thanks for this suggestion.
I would personally see this as the responsibility of the server admin to keep the server time synchronized accordingly.
Otherwise we could no longer use the built-in php functions to get the current time.

But what we imho could consider is adding a simple diagnostic, that checks if the current server time is out of sync with a (customizable) ntp server.

@sgiehl sgiehl added this to the For Prioritization milestone Jun 3, 2022
@ziegenberg
Copy link
Contributor

I agree. Keeping your server clock in sync is the responsibility of the server admin. Where would you want to store the current time so it's cached for the subsequent request? Otherwise, running an extra NTP query for every request would be a massive burden on the NTP server.

@michalkleiner
Copy link
Contributor

michalkleiner commented May 19, 2023

We could possibly just store a single delta value that would be the difference between the time provided by a configured NTP server and the current server time. Updated every hour or so (or configurable interval). Plus add a second configuration option for alerting purposes as a threshold, so that when the difference becomes larger than the configured threshold a warning would display in the dash or an email could be sent. We can discuss what the allowed default difference should be, I'd start with 60 seconds.

@sgiehl
Copy link
Member

sgiehl commented May 19, 2023

@michalkleiner I don't think it's worth the effort to implement that all across Matomo. As mentioned above, the server admin can simply set up a cron to sync the server time with a certain ntp server. Also it might actually be enough to only implement that for the tracker. So that the time of a tracked visit would be shifted by the mismatching time to ensure the datetime stored in the database is correct in the end. This scenario might even be solvable with a custom plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Projects
None yet
Development

No branches or pull requests

5 participants