Is there a way to get the percentage (%) increase and rate of document growth?

Hello,
I have the following code to display the number of document over time in all my indexes:

.es(q=*, index=analytics-prod*).mvavg(5).lines(width=1.5,stack=true,fill=4).label("analytics-prod").cusum(),
.es(q=*, index=analytics-staging*).mvavg(5).lines(width=1.5,stack=true,fill=4).label("analytics-staging").cusum(),

is there a way to get the percentage (%) increase and rate of document growth?

any advice is much appreciated

Hey @Norman_Khine, great question!

Percent Increase

I'm not exactly sure how the percent increase of document count over time would work in timelion. The only thing I could come up with is something like this...

.es(index=analytics-prod*).mvavg(5).divide(.es(index=analytics-prod*).mvavg(5).cusum()).multiply(100)

the difficulty is that it should really be (sum/total cumulative sum) but in timelion the cusum only starts accumulating from the starting time range. But to be accurate you need the cumulative sum over the entire history of the index. So this expression will only be accurate when the entire history of the index is within the set time range.

You could correct this if you knew the total historical count, then you could just add that to the cusum value, but I don't see a way to get that value.

You may want to look into Serial Differencing Aggregation but I'm not sure if that's what you are looking for.

Rate of document growth

I think the .derivative function may be useful to show the rate of document growth. Something like...

.es(index=analytics-prod*).mvavg(5).derivative(),

Let me know if that helps.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.