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

One missing timeseries metric in DQL query, result in "There are no records" for the whole query

cabeywardhana
Visitor

I have a complex query which is incorporating multiple metrics in one DQL query via multiple joins.

My issue is that if one of the metric(the whole timeseries) is missing, the whole query returns "There are no records"

 

 

timeseries avg(metric1)
    interval: 10m
    by: {id}
| join [ 
    timeseries avg(metric2, default:0), nonempty:true,  
    interval: 10m
    by: {id}
], on: {_id}, prefix:"prefix1"
| join [
    timeseries avg(metric3), 
    interval: 10m
    by: {id}
], on: {_id}, prefix:"prefix2"

 

 

I have tried adding nonempty and default value to DQL query as suggested here for the missing metric without any luck. e.g. metric2 is missing the timeseries. 

 

 

timeseries avg(metric2, default:0), nonempty:true, 

 

 

The result I am expecting is that the complex query will still return a result with the metrics data from other two(available) timeseries + default values for the missing timeseries metric. 
Is this possible ?

2 REPLIES 2

krzysztof_hoja
Dynatrace Pro
Dynatrace Pro

Before I attempt to explain, here are my test data. I will use 2 metrics for 2 hosts. First metric is available for both host while second only for one:

krzysztof_hoja_0-1710531718715.png

If I retrieve both metrics using single timeseries command, the result would look like:

krzysztof_hoja_1-1710531864807.png

As you can see only one record with pair of metrics is returned for the host where both metrics are available. To have both metrics using such construct, I would use union:true option of timeseries command.

krzysztof_hoja_2-1710532048690.png

this option cases that records/rows when some metrics are missing are not eliminated. Here is how join command behaves with the same data:

krzysztof_hoja_3-1710532179654.png

But join command offers also option kind:leftOuter which does not eliminate records returned by basic query where corresponding record from subquery is missing

krzysztof_hoja_4-1710532345049.png

Of course first query has to provide superset of what subquery returns.

Kris

 

 

@krzysztof_hoja Thank you for the solution, your awesome suggestion works for my scenario. 

Featured Posts