Support decorators in Ceilometer API methods

Bug #1226482 reported by Ladislav Smola
6
This bug affects 1 person
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={"B": (float, to_gigabytes, lambda x: x + ' GB')} which will convert it to some float format and convert B to GB and add 'GB' string to the end

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://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.

Tags: ceilometer
Ladislav Smola (lsmola)
tags: added: ceilometer
Ladislav Smola (lsmola)
description: updated
Revision history for this message
Ladislav Smola (lsmola) wrote :

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.

Revision history for this message
Gabriel Hurley (gabriel-hurley) wrote :

This would likely be better as a blueprint, but I'll keep the ticket for now.

Changed in horizon:
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
Ladislav Smola (lsmola) wrote :

ok, I will create a blueprint from this

Revision history for this message
Ladislav Smola (lsmola) wrote :
Changed in horizon:
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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