Transformer of type "unit_conversion": "scale" parameter
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Ceilometer |
Triaged
|
Low
|
Tran Ly Vu |
Bug Description
For testing purposes, I tried to create a very simple new transformer, converting cpu in nanoseconds to "cpu_sec" in seconds. The "scale" parameter behaves differently : if it is a numeric value, it is a scale factor for the volume. But if it's a string, it must be an expression containing "volume". In other words,
scale: 0.000000001
is not the same as
scale: "0.000000001"
but it is the same as
scale: "volume * 0.000000001"
In transformer/
return ((eval(scale, {}, ns) if isinstance(scale, six.string_types)
If "scale" is a string, its value is taken as such, not multiplied with "s.volume".
I find this not very intuitive, particularly because the "cpu_sink" - the one that calculates "cpu_util" - has a scale string which simply becomes a factor. But the cpu_util is a "rate_of_change" transformer :
scale: "100.0 / (10**9 * (resource_
Maybe you want to consider either putting this detail into the documentation or adding the factor "s.volume" into conversions.py for a "scale" string ?
Changed in ceilometer: | |
assignee: | nobody → Viktor Horvath (viktorhorvath) |
Changed in ceilometer: | |
importance: | Medium → Low |
assignee: | Viktor Horvath (viktorhorvath) → nobody |
Changed in ceilometer: | |
assignee: | nobody → Tran Ly Vu (tranlyvu) |
I'll prepare a tiny patch for conversions.py, because from the documentation example on docs.openstack. org/developer/ ceilometer/ configuration. html#unit- conversion- transformer
http://
it's clear that this is supposed to work:
Sample configuration:
transformers:
- name: "unit_conversion"
parameters:
target:
name: "disk.kilobytes"
unit: "KB"
scale: "1.0 / 1024.0"