Ceilometer API statistics Decorators and Unit convertors

Registered by Ladislav Smola on 2013-09-18

Right now, the Ceilometer API statistics methods returns all statistics in their default unit and format.

We should be able to define decorators(or maybe name it filters, as this naming is already used in Horizon) and unit convertors for the meters for the statistics list, so we can easily define that cpu should be decorated as 12.3days, instead of 1... ns

We should be able to define:
1. Decorators based on Meter names
e.g. decorators={'cpu': (float, lambda x: x + ' GB')} which will convert it to some float format and add 'GB' string to the end
1.1. Define default decorators for each Meter name
default decorators can be redefined by 1. for specific statistics

2. Unit conversion based on Meter name
e.g. conversions={'cpu'=> 'Days', 'memory'=> 'GB'}
2.1 Default conversions for each meter name
default conversions can be redefined by 2. for specific statistics

The order of applying will be: first Conversion, then Decorating

!!! important
As the decorator will be changing a unit, I need to be able to obtain the unit back.
So it has to be somehow connected to this https://bugs.launchpad.net/horizon/+bug/1226479

Probably, every meter statistic should hold a object of the Meter, that contains the current Unit. After converting the meter statistic to another unit, we should change the Meter object unit.

So e.g. the to_hours convert method could obtain the original unit from Class definition of the cpu Meters. The current unit would be available in the Meters object that holds the cpu.

Looking back, it might be better to not join decorator and converting logic.

Converting logic could reside in Meters class.

Blueprint information

Status:
Complete
Approver:
David Lyle
Priority:
Medium
Drafter:
Ladislav Smola
Direction:
Approved
Assignee:
Ana Krivokapić
Definition:
Approved
Series goal:
Accepted for kilo
Implementation:
Implemented
Milestone target:
milestone icon 2015.1.0
Started by
Ana Krivokapić on 2014-06-03
Completed by
Ana Krivokapić on 2014-11-21

Whiteboard

[lsmola | 22.10.2013]

For unit conversions, it would be better to use some library, rather than code it myself.
e.g.:
https://pypi.python.org/pypi/units/0.06
https://pypi.python.org/pypi/quantities/
https://pint.readthedocs.org/en/latest/
http://code.google.com/p/buckingham/

[2014-01-12 david-lyle] moving to i-3 as not started yet

[2014-02-03 | david-lyle] moving out of icehouse

Gerrit topic: https://review.openstack.org/#q,topic:bp/ceilometer-api-statistics-decorators-and-convertors,n,z

Addressed by: https://review.openstack.org/96800
    WIP: Add unit conversion for metering views

[david-lyle | 2014.07.23] Moving to Juno-3. Blocked by requirements changes.

[david-lyle 2014.09.02] Moving out of Juno. Looks like it needs more work.

Gerrit topic: https://review.openstack.org/#q,topic:bug/1384248,n,z

(?)

Work Items

Dependency tree

* Blueprints in grey have been implemented.

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.