Aggregation (rollup) of complex compound metrics


We’re trying to optimize actionDecl metrics that call rollupMetric over a number of sources, on time-consuming compound metrics.

If I understand correctly, there are three aggregation levels:

  1. temporal: AGGT(TS) where AGGT is an aggregation ExpressionEngineFunction, e.g., avg, over consecutive time intervals
  2. spatial: AGGS(AGGT(TS)) where AGGS is an aggregation ExpressionEngineFunction, e.g., sum, over timeseries sharing a header/source
  3. logical: rollup(AGGL, AGGS(AGGT(TS))...) where AGGL is an aggregation ExpressionEngineFunction, e.g., sum, over multiple sources (ids)

Q1. Is there a way to transform 3. above into 2. above by somehow creating a virtual common source (without destroying existing connections)?
Q2. Would a Q1-based solution be faster than rollup/rollupMetric ?

Q3. Is there a way to use Expression Engine’s rollup and collect the timeseries arguments like it is done for rollupMetric using its ids / filter argument?
Q4. Would a MetricFunctionLibrary be possible and faster than rollupMetric?
Q5. Does rollupMetric parallelize the aggregation to end up with logarithmic time complexity in the number of timeseries aggregated upon?

Q6. Can evalPlanInclude option evalInstrumentation be made to penetrate an actionDecl that calls rollupMetric on a CompoundMetric? At the moment, we only see one line with total time taken; and using cache property does not seem to help.


Caching (simple) actionDecl that rollupMetric compound metrics