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

How to calculate a ratio between two metrics in Dynatrace SaaS Dashboards (DQL)?

Irdina
Frequent Guest

 

Hi,
I'm new to Dynatrace and DQL, and I’d appreciate some advice. I'd like to calculate a ratio between two metrics (avg(read_time) / avg(write_time)) and display it as a single value in the Dynatrace SaaS Dashboards App.

Is this possible, and what’s the correct way to do it?

Thanks in advance!

3 REPLIES 3

Emm4nuel
Dynatrace Helper
Dynatrace Helper

Hi Irdina,

Please try this DQL and see if this is what you are trying to achieve:


This is a time series showing the ratio of average disk write time to average disk read time over time, with the intermediate metrics removed for clarity.

timeseries { write_time = avg(dt.host.disk.write_time), read_time = avg(dt.host.disk.read_time) }
| fieldsAdd expression = write_time[] / read_time[]
| fieldsRemove write_time, read_time

 

Yes, thank you for the help, the solution u gave is a great start to have.

Irdina
Frequent Guest

Current update:
__________________________
timeseries {
write_time = avg(dt.host.disk.write_time),
read_time = avg(dt.host.disk.read_time)
}
| fieldsAdd wt = arrayAvg(write_time), rt = arrayAvg(read_time)
| fieldsAdd ratio = concat(tostring(toLong(wt)), ":", tostring(toLong(rt)))
| fieldsKeep ratio
_____________________
I extended the logic to convert the metric outputs into scalar values suitable for a single value tile. I also included a string-based ratio format

Featured Posts