Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to count events in Datadog Screenboard

Tags:

datadog

I don't understand the difference between events and metrics in DataDog. I'm trying to create a count indicator in my dashboard so I can now how many times some type of event has happened.

enter image description here

There is a lot of events named some.event.name, but no matter what query I use, it always returns 1.

I've tried with this queries,

sum:some.event.name{*}

count_nonzero(sum:some.event.name{*})

count_not_null(sum:some.event.name{*})

I've also tried with other aggregation functions avg|max|min|sum and allways the result is 1.

Any help will be highly appreaciated.

like image 839
mariowise Avatar asked Mar 21 '17 12:03

mariowise


1 Answers

Well I realized that the query value only works with metrics, so to create a counter we can emit metrics with value: 1 and then count them with the rollup(sum, 60) function.

dog.emit_point('some.event.name', 1)

sum:some.event.name{*}.rollup(sum, 60)

The main thing to understand here is that DataDog does not retrieve all the points for a given timeframe. Actually as McCloud says, for a given time range we do not return more than 350 points, which is very important to have in mind when you create a counter.

When you query value from a metric in a timeframe, DataDog return a group of points that represents the real stored points, not all the points; the level of how those points are represented (as I understand) is called granurallity, and what you do with this rollup function is to define how those points are going to represent the real points, which in this case is going to be using the sum function.

I hope this helps somebody, I'm still learning about it. Regards

like image 186
mariowise Avatar answered Oct 19 '22 04:10

mariowise