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

Timeseries - Distinct count regardless of the time interval value

jegron
DynaMight Champion
DynaMight Champion

Hi,

I'd like to graph a metric that counts distinct values of a dimension over time, regardless of the time interval value.

Example : 

  • timeseries { sum = sum(mymetrics, default: 0)}, by:{dimension1, dimension2}, interval:1m => OK
  • timeseries { sum = sum(mymetrics, default: 0)}, by:{dimension1, dimension2}, interval:10m => KO

Do you have a tip?

 

Observability Engineer at Phenisys - Dynatrace Professional
2 REPLIES 2

krzysztof_hoja
Dynatrace Champion
Dynatrace Champion

Here is example query which calculates distinct count of values of "k8s.workload.name" dimension over time:

timeseries {containersCnt = sum(dt.kubernetes.containers), timestamp=start()},
  by: { k8s.workload.name }
  
| fieldsAdd d=record(containersCnt=containersCnt[], timestamp=timestamp[])
| expand d 
| filterOut isNull(d[containersCnt])

| makeTimeseries countDistinct(k8s.workload.name), time:d[timestamp]

 

krzysztof_hoja_0-1729802738309.png

 

jegron
DynaMight Champion
DynaMight Champion

Perfect! Thanks a lot.

Are you planning to simplify makeTimeseries use for timeseries? It is not easy right now ...

Observability Engineer at Phenisys - Dynatrace Professional

Featured Posts