KeepOnlyOneAggregationFunction

This aggregator can be used as follows:

  • On Copper, with .custom(KeepOnlyOneAggregationFunction.PLUGIN_KEY)
  • On post-processors that have a reduce stage, with pp.withProperty(DYNAMIC_AGGREGATION_PARAM_AGGREGATION_FUNCTION, KeepOnlyOneAggregationFunction.PLUGIN_KEY).

This aggregator can’t be used on an aggregated measure as it does not implement the disaggregate feature.

This aggregator will return the same value as input only if there is a unique, single input value. If there is no input value or there are multiple input values, the return is null.

Example

The aggregator defined here

Copper.measure("Metric")
        .per("Level")
        .custom(KeepOnlyOneAggregationFunction.PLUGIN_KEY)

will return the following, depending on the aggregation levels:

Only one level aggregation

Level Metric Count
Total 6.5 1
Single Level 6.5 1

Level Metric Count
Total 6.5 2
Level 1 6.5 1
Level 2 1

Multiple-level aggregation

Level Metric Count
Total 2
Level 1 6.5 1
Level 2 6.5 1

Level Metric Count
Total 3
Level 1 1.5 1
Level 2 2.5 1
Level 3 3.5 1