cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

count_over_time equivalent

SimGiants92
Visitor

I have a duration metric that is populated every time a pipeline runs, i would also like to use this metric to see trends on how often the pipeline is run and the outcome. But because this is not very frequent a simple count on the timeseries does not give a very revealing graph. Instead i would need the sum over the time period for each datapoint to get a clearer picture, the equivalent of count_over_time in prometheus.
I see that i can do an array modification with arrayCumulativeSum or arrayMovingSum but i would need instead something related to time both options above also always start from a low sum which is not ideal.
Is there a way to do this?

1 REPLY 1

krzysztof_hoja
Dynatrace Champion
Dynatrace Champion

I think this maybe helpful to get data you want to see.

I have metric (response time for service) which behaves quite like in your description: sometimes we have measurement with major break in between.

Query to get the data looks like this:

timeseries rt = avg(dt.service.request.response_time), filter:dt.entity.service=="SERVICE-4B4EB791A0B161BC"

The result looks like (one measurement over 0.8s, several below 50ms)

krzysztof_hoja_1-1747752468025.png

Apart of actual measurement (response time in this case), each timeseries keeps number of measurements/contributions to metric in specific time slot. To get this information use of rollup:total option is needed:

timeseries inv = sum(dt.service.request.response_time, rollup:total), filter:dt.entity.service=="SERVICE-4B4EB791A0B161BC"

krzysztof_hoja_2-1747752596216.png

Now we can see number of measurements over time. Of course spaces between bars stay away from each other, but timeseries command has interval: option which allows to widen interval according to needs. In my example I widen interval from default 1 minute to 10 minutes:

timeseries inv = sum(dt.service.request.response_time, rollup:total), filter:dt.entity.service=="SERVICE-4B4EB791A0B161BC", interval:10m

 Now bars are not longer apart:

krzysztof_hoja_3-1747753115165.png

I hope this helps.

 

Featured Posts