9

We have a counter metric in one our micro services which pushes data to DataDog. I want to display the total count for given time frame, and also the count per day (X axis would have the date and Y axis would have count). How do we achive this?

I tried using sum by and diff with Query value representation. It gives the total number of the count for given time frame. But I would like to get a bar graph with the X axis as the date and the Y axis as the count. Is this possible in DataDog?

nyarasha
  • 1,119
  • 1
  • 14
  • 24
Selvakumar Ponnusamy
  • 5,363
  • 7
  • 40
  • 78
  • 7
    Maybe you need the `.rollup()` method? `.rollup(sum, 86400)` or something? I think that should work for this case. https://help.datadoghq.com/hc/en-us/articles/204526615-What-is-the-rollup-function-?mobile_site=true – stephenlechner Sep 27 '17 at 11:12
  • 3
    Yes, I figured out the same and solved it. I used diff(sum:.rollup(max, 86400)) – Selvakumar Ponnusamy Sep 28 '17 at 07:18
  • @SelvakumarPonnusamy considering you self-solved, would you mind posting the solution as an answer and self-accepting, so the question gets answered? – Mike Fiedler Nov 20 '22 at 01:06

1 Answers1

1

It seems like there are 2 main questions here:

  1. display the total count for a given time frame.
  2. the count per day.

I think the rollup method is going to be your friend for both questions.

For #1 you need to pass in the time frame you want a total over: sum:<metric_name>.rollup(sum, <time_frame>) and the single value can be displayed using the Query Value visualization.

For #2 the datadog docs say you can get metrics per a day by

graphed using a day-long rollup with .rollup(avg,86400)

So this would look something like sum:<metric_name>.rollup(sum, 86400) and can be displayed a Timeseries with bars.

jjbskir
  • 8,474
  • 9
  • 40
  • 53