Updated openstack/openstack
Project: openstack/ceilometer  971f9c85c1051d3291345152e4974f7beed23bf1

Multi meter arithmetic transformer

New pipeline transformer that enables us to perform arithmetic calculations
over one more meters and/or their metadata, for example:

    memory_util = 100 * memory.usage / memory .

The calculation is limited to meters with the same interval.

Example configuration:

    - name: "arithmetic"
      parameters:
        target:
          name: "memory_util"
          unit: "%"
          type: "gauge"
          expr: "100 * $(memory.usage) / $(memory)"

To demonstrate the use of metadata, here is the implementation of
a silly metric that shows average CPU time per core::

    - name: "arithmetic"
      parameters:
        target:
          name: "avg_cpu_per_core"
          unit: "ns"
          type: "cumulative"
          expr: "$(cpu) / ($(cpu).resource_metadata.cpu_number or 1)"

Expression evaluation gracefully handles NaNs and exceptions. In such
a case it does not create a new sample but only logs a warning.

DocImpact: add documentation about using this new transformer
Implements: blueprint arithmetic-transformer
Change-Id: I1b637e5b1d1bb15ed3c3d7ec758d2a684eaccf21