[Hawkular-dev] UTC Timezone - Default for Services
Stefan Negrea
snegrea at redhat.com
Wed May 13 15:11:17 EDT 2015
Hello Everybody,
With the metrics aggregation work well under way, we have encountered the first case where timezones are important. The task queue [1] that John wrote to be used in the aggregation process is time sensitive. The tasks ran according to a schedule that is predefined; the time relationship also applies to failures, retries, and cancellation. Based on the experience we had with RHQ, not using an UTC timezone can lead to errors and loss of data (for more details visit [2])
I propose to set the default time zone for all the services to UTC. Only allow the concept of a timezone in the UI. This will avoid any problems due to automatic transitions between DST and non-DST times. For example, if the user wants to schedule something 2 weeks from now, let the UI handle the user selection. But when the user action is sent to the backend, it should be expressed in an timezone agnostic manner (eg. milliseconds since Unix Epoch).
The PR [1] sets the default timezone for the JODA library to be UTC for the classloader that contains the metrics service. With the recent discussions about creating a combined Kettle EAR or using a single classloader, that means this setting will extend to all the services in the same classloader that use JODA. And this is just the default, if a service really needs to set another timezone for a date object, it can be done by just specifying the timezone.
We tried to make the change more local in the metrics code, but the approach was error prone. Anybody could make a mistake and instantiate a date object in the current server timezone rather than UTC. This global approach drastically limits inadvertent mistakes.
Two questions for the group:
1) Does anybody see any issues with using the UTC timezone as default at the services layer?
2) Should we expand this setting to the JVM (not just JODA)?
[1] Task queue PR - https://github.com/hawkular/hawkular-metrics/pull/205
[2] Old RHQ thread - https://lists.fedorahosted.org/pipermail/rhq-devel/2014-November/003709.html
Thank you,
Stefan Negrea
Software Engineer
More information about the hawkular-dev
mailing list