# Metric events that sum values in a certain time period?

**URL:** <https://community.dynatrace.com/t/metric-events-that-sum-values-in-a-certain-time-period/40635>\
**Category:** Alerting\
**Tags:** dynatrace-managed, problems-classic\
**Created:** [July 11, 2023, 8:43pm UTC](https://community.dynatrace.com/t/metric-events-that-sum-values-in-a-certain-time-period/40635 "2023-07-11T20:43:24Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [July 11, 2023, 8:43pm UTC](https://community.dynatrace.com/t/metric-events-that-sum-values-in-a-certain-time-period/40635/1 "2023-07-11T20:43:24Z")

</div>

I have an extension that sums unavailability timings, in 5 minutes intervals. So, at every 5 minutes I have datapoints like failed 10 seconds in the last 5 minutes. Values are from 0 to 300 seconds, for each 5 minute datapoints

Now, I want to setup an alert, through metric events, if it fails like more than 12 minutes in the last 15 minutes. I have tried, but I have not got there. I have several approaches that get near, but would like to know if someone can nail this one?

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [July 11, 2023, 9:46pm UTC](https://community.dynatrace.com/t/metric-events-that-sum-values-in-a-certain-time-period/40635/2 "2023-07-11T21:46:20Z")

</div>

[@AntonioSousa](https://community.dynatrace.com/user/17213)&nbsp;What about using [rollup](https://www.dynatrace.com/support/help/shortlink/api-metrics-v2-selector#rollup) for that?

```markup
:rollup(sum,"15m")

```

This should give you sum of your datapoints from last 15 minutes, and then compare it against fixed value of 12?

---

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [July 11, 2023, 10:39pm UTC](https://community.dynatrace.com/t/metric-events-that-sum-values-in-a-certain-time-period/40635/3 "2023-07-11T22:39:57Z")

</div>

[@Julius\_Loman](https://community.dynatrace.com/user/3364),

Spot on! Still testing, but seems it will meet the requirements. Had completely forgotten about all the other transformations that you don’t have in the Data Explorer interface!

For all eventually seeing this in the future, if you get the cryptic message  
“Illegal transform operator: Usage of RollupOperator{rollup=sum, rate=15m} requires a previous value extraction.”

you need to provide an aggregation (eg. avg) which I wasn’t using.

One thing I noticed is that in the Alert preview I went from  
_The number of metric dimension values in the last 24 hours is 748_  
to  
_The number of metric dimension values in the last 24 hours (52360) exceeds the limit of 1000. Please refine the filter criteria or use a metric key based query definition._

Seems like only associated with the Alert preview, hope it doesn’t impact DDU consumption. I do have real sparse data here (if I don’t have failures in each 5 minutes, there is no data point), so not really impacted, besides not getting the Alert preview.

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [July 12, 2023, 5:13am UTC](https://community.dynatrace.com/t/metric-events-that-sum-values-in-a-certain-time-period/40635/4 "2023-07-12T05:13:10Z")

</div>

Sure, you need to extract a value to perform the rollup. About dimensions - you already have that data in Dynatrace, so DDUs are already consumed as they are billed on metric ingestion. Maybe you need to remove dimensions completely or just level some by using :splitBy(…) ?

---

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [July 12, 2023, 8:25am UTC](https://community.dynatrace.com/t/metric-events-that-sum-values-in-a-certain-time-period/40635/5 "2023-07-12T08:25:35Z")

</div>

[@Julius\_Loman](https://community.dynatrace.com/user/3364)

Yes, I do use splitBy(), but for the dimension being splitted, there can be thousands of values. I’m not sure if I’m going to hit some type of limit, and therefore not have certain events being generated. I’m checking with the data, to be sure on that…

---

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [July 12, 2023, 11:18pm UTC](https://community.dynatrace.com/t/metric-events-that-sum-values-in-a-certain-time-period/40635/6 "2023-07-12T23:18:09Z")

</div>

[@Julius\_Loman](https://community.dynatrace.com/user/3364),

Just to complement I was affected by throttling. I wrote a little bit about it here:  
[https://community.dynatrace.com/t5/Dynatrace-tips/Metric-Events-limits/m-p/217854](https://community.dynatrace.com/post/217854)

Do you have an idea why the rollup() affectedthe metric dimension values so much, from 748 to 52360?

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [July 13, 2023, 6:39am UTC](https://community.dynatrace.com/t/metric-events-that-sum-values-in-a-certain-time-period/40635/7 "2023-07-13T06:39:14Z")

</div>

[@AntonioSousa](https://community.dynatrace.com/user/17213)&nbsp;can you share your metric expression and also some screenhosts/data?

---

<div class="post-metadata">

**Author:** ![TorstenHellwig](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/torstenhellwig/32/33996_2.png) [@TorstenHellwig](https://community.dynatrace.com/u/TorstenHellwig)\
**Post date:** [October 29, 2024, 12:20pm UTC](https://community.dynatrace.com/t/metric-events-that-sum-values-in-a-certain-time-period/40635/8 "2024-10-29T12:20:35Z")

</div>

Hmm, now this stops where it’s getting interesting. I need to use rollup to smoothen the metric and it let’s dimensions explode. I just don’t get why.

The expression looks like this:&nbsp;\<metric\_key\>:sum:splitBy(“dt\_name”):rollup(min,30m).

The dimension has a handful of values only. As soon as I remove the rollup, no problem.

Any idea how to prevent this? I tried reordering the expression, nothing seems to work.
