Support decorators in Ceilometer API methods
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Dashboard (Horizon) |
Invalid
|
Low
|
Unassigned |
Bug Description
Right now, the Ceilometer APi returns all statistics in their default unit and format.
1. Be able to define decorators(or maybe name it filters, as this naming is already used in Horizon) 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 decorator based on:
1.1 Unit
e.g. unit_decorators
1.2 Meter name
e.g. decorators={'cpu'=> (to_hours,)}
2. Define default decorators, like always show GB instead of B. Though that default decorators could be redefined in the specific list.
It would always use only 1 list of decorators, if there will be more decorators defined for a meter, based on their priority. Priorities from highest to lowest:
1. Meter name decorator
2. Unit decorator
3. Default decorator
!!! 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:/
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.
Statistics methods would take units={ 'cpu'=> 'GB'}, or default units defined in Meters class. I would cancel the 1.1 Unit decorator, as it seems to complex for now.