getDistribution() requirements question / performance concern

#1

On the platform function of .getDistribution --> https://github.com/c3-e/c3server/blob/5263277104246f86cbe40b000205341bdd5aa9d9/repo/server/platform/src/metric/MetricEvaluatable.js#L341

We have a line that basically says evaluate the function daily if you want the result to represent the last 12 months: interval : !period || period === ‘last12m’ ? ‘DAY’ : ‘YEAR’,

The function is almost entirely use to evaluate and render a single value per ID aggregated across the whole year, Other acceptable periods are actual Years- 2012, 2014, etc

Few questions:

  1. Is it necessary to do a daily eval to show the past 12 month result? Couldnt we do MONTH or YEAR and just aggregate the various returned values? Doing it daily is a higher tax on the function.

  2. The large performance concern is that even if we cache the DAILY result, the UI/browser is very slow to load all 365 values for the potentially 1000s of objects we are putting into the histogram.

0 Likes