Search code examples
dashboardmetricsdatadog

Display the date of the last value for a custom metric in Datadog


I'm searching to display in a DD Dashboard the date of the last value of a metric. I can use a simple QueryValue field for that, however I don't know how I can get the date of this metric instead of its value.

Example : mymetric = [21,5,42] let's say that the relevant dates for those metrics are ['1/1/2022', '1/2/2022', '27/2/2022']

I'd like to display 27/2/2022.

For now, I'm displaying only the value with this query


"queries": [
    {
         "query": "max:mycounter{$env}",
         "data_source": "metrics",
         "name": "query1",
         "aggregator": "last"
    }
]

Is it possible with Datadog ?

In fact I've found a workaround, but that seems a little bit unoptimized. I push also from my code mycounter.date_day mycounter.date_month and mycounter.date_year. And then I can display day month year in 3 different QueryValue.

Regards, Blured.


Solution

  • This is not a use case Datadog metrics are designed for. Any solution you find is going to be pretty hacky.

    This seems like maybe instead of a custom metric, you'd want to be sending a log or event, with date/time attributes that you can display. Even that doesn't really sound close to what you're looking for though.

    If you really wanted to get this working in a clean way, I suppose you could try developing your own custom Datadog widget as an app: https://www.datadoghq.com/blog/datadog-apps/ (reference docs)

    But whatever your goal is might just have to be redesigned to make more sense for what Datadog is built for.