Processor: Ratio

The Ratio processor calculates the ratio of inputs. It takes two inputs: numerator and denominator. Denominator is optional and could be specified as ‘denominator’ configuration property instead. It could be either an integer or an expression that evaluates to an integer. It should not be ‘0’.

When ‘denominator’ is specified as an input, ‘numerator’ and ‘denominator’ input items must allow only 1:1 mapping. If that is not the case, ‘significant_keys’ configuration property should be specified to list keys that will allow such mapping.

It also supports ‘multiplier’ configuration property, which is an integer value greater than one to multiply numerator by before calculating ratio. This allows it to overcome limitations of dealing with integers. Default value is 100.

Input Types - Number-Set (NS)

Output Types - Number-Set (NS)


Integer or an expression that evaluates to integer that is used as denominator. Optional denominator value if it’s not specified as input; should be non-zero integer or an expression that evaluates to non-zero integer.
Significant Keys (significant_keys)
List of keys to map items from the inputs for applying the specified operation. It is typically used by processors that take multiple inputs and perform operations on them. When inputs have the same sets of keys it does not need to be specified. When inputs have different sets of keys, it must be specified and it must allow only 1:1 items mapping from the given inputs, otherwise the probe will go into error state.
Multiply numerator by a given value before calculating ratio. Optional. Default is 100.
Enable Streaming (enable_streaming)
Makes samples of output stages streamed if enabled. An optional boolean that defaults to False. If set to True, all output stages of this processor are streamed in the generic protobuf schema.

Ratio Output Example

Simple scenario with a static denominator.

denominator: 100
multiplier: 1

Input ‘numerator’:

[system_id=spine1,role=spine,interface=eth0]: 300
[system_id=spine2,role=spine,interface=eth1]: 500


[system_id=spine1,role=spine,interface=eth0]: 3
[system_id=spine1,role=spine,interface=eth1]: 5

Configuration where numerator and denominator are coming from inputs, and ‘multiplier’ value is the default 100:

significant_keys: ['system_id', 'interface']

Input ‘numerator’:

[system_id=spine1,role=spine,interface=eth0]: 300
[system_id=spine2,role=spine,interface=eth1]: 750

Input ‘denominator’:

[system_id=spine1,role=spine,interface=eth0]: 150
[system_id=spine2,role=spine,interface=eth1]: 250


[system_id=spine1,interface=eth0]: 200
[system_id=spine1,interface=eth1]: 300