Inconsistent timestamp formats in ceilometer messages

Bug #1372791 reported by Daniele Venzano
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Undecided
Vincent Hou

Bug Description

The messages generated by cinder-volume-usage-audit contain timestamps in a different format than the other messages received through UDP from ceilometer-agent-notification. This creates unnecessary troubles for whoever is trying to decode the messages and do something useful with them.

I particular, up to now, I found out about these fields:
- timestamp in volume and volume.size messages
- resource_metadata.created_at in volume and volume.size messages
- resource_metadata.launched_at in volume and volume.size messages
- resource_metadata.audit_period_* in volume and volume.size messages

They contain UTC dates (I hope), but there is no Z at the end, and they contain a space instead of a T between date and time. In short, they are not in ISO8601 as the timestamps in the other messages. I found out about them because elasticsearch tries to parse them and fails, throwing away the message.

This bug was has been reported against Ceilometer, but I have been redirected here:
https://bugs.launchpad.net/ceilometer/+bug/1370607

Revision history for this message
Vincent Hou (houshengbo) wrote :

Interesting.
I will take a look.

Changed in cinder:
assignee: nobody → Vincent Hou (houshengbo)
Revision history for this message
Daniele Venzano (venza) wrote :

This bug is the same, but for neutron-metering messages:

https://bugs.launchpad.net/neutron/+bug/1372792

It contains a procedure to replicate the problem and some packet logs that evidence the problem (in Neutron, but for Cinder the problem is exactly the same).

Revision history for this message
Vincent Hou (houshengbo) wrote :

Hi Daniele,
I think I have found the root cause for this issue.
In cinder/volume/utils.py, the method _usage_from_volume is supposed to return the information reported to ceilometer for the volume. Some datetime information like created_at and launched_at have been converted to string, that is why they are mssing the ISO8601 format.
In fact, volume_ref['launched_at'] and volume_ref['created_at'] are not string type in the database, but DateTime. If we replace te line created_at=null_safe_str(volume_ref['created_at']) wth created_at=timeutils.isotime(at=volume_ref['created_at']), the ISO8601 format will be kept. This is my proposal to resolve this issue. Plase review my patch for it.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

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

Changed in cinder:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/134861
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=0ecba69df002a319ce30ae554dbf0182b2a01f98
Submitter: Jenkins
Branch: master

commit 0ecba69df002a319ce30ae554dbf0182b2a01f98
Author: Vincent Hou <email address hidden>
Date: Sun Nov 16 22:33:35 2014 -0800

    Convert the DateTime into ISO8601 format for Ceilometer

    The fields of DateTime type should be converted to the time in
    ISO8601 format, when they are put in the usage information to be
    reported to Ceilometer.

    Change-Id: I67e9e3609291d0d835156dfd9cfda88deae119c1
    closes-bug: #1372791

Changed in cinder:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in cinder:
milestone: none → kilo-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in cinder:
milestone: kilo-1 → 2015.1.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.