How to calculate derivative in druid

Hi guys,

I have a metric of total_cpu_time ingested to druid. But it’s a accumulated value, I want to calculate the cpu_usage which will be calculating derivative of two records (total_cpu_time1 - total_cpu_time2) /(time1-time2)

do you have any idea how can I implement this post-aggregation function?

thanks,

song

Hi Song,

Have you considered looking at AVG(total_cpu_time) per time granularity?

Example for getting an average using post aggregators: http://druid.io/docs/latest/querying/post-aggregations.html#example-usage