aggregation won't work when start/stop are set and timezone not UTC

Bug #1544014 reported by Mehdi Abaakouk
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Gnocchi
Fix Released
High
Mehdi Abaakouk
1.3
New
Undecided
Unassigned

Bug Description

How to reproduce with gnocchi command line:

I fill a named metric 'test' of a resource '2228fa6e-b186-405b-81c4-5d8ddced7e23':

$ gnocchi measures show -r 2228fa6e-b186-405b-81c4-5d8ddced7e23 test | tail -3
| 2016-02-10T11:46:02+00:00 | 1.0 | 55.0 |
| 2016-02-10T11:46:03+00:00 | 1.0 | 63.0 |
+---------------------------+-------------+---------------+

$ gnocchi --debug measures aggregation --query 'id="2228fa6e-b186-405b-81c4-5d8ddced7e23"' -m test --needed-overlap 0 | tail -3
| 2016-02-10T11:46:02+00:00 | 1.0 | 55.0 |
| 2016-02-10T11:46:03+00:00 | 1.0 | 63.0 |
+---------------------------+-------------+---------------+

$ gnocchi --debug measures aggregation --query 'id="2228fa6e-b186-405b-81c4-5d8ddced7e23"' -m test --needed-overlap 0 --start "2016-02-10T11:00:02" --stop "2016-02-10T11:46:03" | tail -3
| 2016-02-10T11:46:02+00:00 | 1.0 | 55.0 |
| 2016-02-10T11:46:03+00:00 | 1.0 | 63.0 |
+---------------------------+-------------+---------------+

# Change the timezone to something non-utc
sudo dpkg-reconfigure tzdata
sudo /etc/init.d/apache2 restart ;

$ gnocchi --debug measures aggregation --query 'id="2228fa6e-b186-405b-81c4-5d8ddced7e23"' -m test --needed-overlap 0 --start "2016-02-10T11:00:02" --stop "2016-02-10T11:46:03" | tail -3

No result when start/stop are set, when I expect ~ the same result as previous cmd.

Mehdi Abaakouk (sileht)
no longer affects: aodh
Julien Danjou (jdanjou)
Changed in gnocchi:
importance: Undecided → High
milestone: none → next
status: New → Triaged
Mehdi Abaakouk (sileht)
summary: - aggregation won't work when start/stop are set
+ aggregation won't work when start/stop are set and timezone not UTC
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to gnocchi (master)

Fix proposed to branch: master
Review: https://review.openstack.org/278427

Changed in gnocchi:
assignee: nobody → Mehdi Abaakouk (sileht)
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to gnocchi (master)

Reviewed: https://review.openstack.org/278427
Committed: https://git.openstack.org/cgit/openstack/gnocchi/commit/?id=bfec10fab16151806a6fc12dc4415c9bc1e72d4c
Submitter: Jenkins
Branch: master

commit bfec10fab16151806a6fc12dc4415c9bc1e72d4c
Author: Mehdi Abaakouk <email address hidden>
Date: Wed Feb 10 16:12:16 2016 +0100

    Don't use time.timezone

    We can't use time.mktime() - time.timezone because they are not always is
    sync when the OS timezone change. time.mktime() returns the new TZ instantly,
    while time.timezone returns the old one.

    time.* constants are updated only when time.tzset() is called.

    This change computes unix timestamp without using time.timezone constant.

    Closes-bug: #1544014

    Change-Id: I825814e270a41870e9f4b1c559f66771f049f884

Changed in gnocchi:
status: In Progress → Fix Committed
Julien Danjou (jdanjou)
Changed in gnocchi:
status: Fix Committed → Fix Released
milestone: next → 2.0.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.