DQL
Questions about Dynatrace Query Language
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Calculate a succes rate line with metrics

enrico_afkl
Newcomer

Hello,
I'd like to calculate a ratio between totalCalls and successCalls using a metric "log.prgoffer.foapi.baminfo.golden.exceptions".

 

timeseries totalCalls=sum(log.prgoffer.foapi.baminfo.golden.exceptions),
interval:
duration(toLong(substring($Interval,from:0,to:stringLength($Interval)-1)),
unit:getCharacter($Interval,stringLength($Interval)-1))

 

and 

 

timeseries successCalls=sum(log.prgoffer.foapi.baminfo.golden.exceptions),

filter: {
matchesValue(baminfo.exception, "OK")
},
interval:
duration(toLong(substring($Interval,from:0,to:stringLength($Interval)-1)),
unit:getCharacter($Interval,stringLength($Interval)-1))

2 REPLIES 2

MaximilianoML
Champion

Hello @enrico_afkl!

You can try this one:

timeseries {
  totalCalls = sum(log.prgoffer.foapi.baminfo.golden.exceptions),

  successCalls = sum(
    log.prgoffer.foapi.baminfo.golden.exceptions,
    filter: matchesValue(baminfo.exception, "OK")
  )
},
interval: duration(
  toLong(substring($Interval, from: 0, to: stringLength($Interval) - 1)),
  unit: getCharacter($Interval, stringLength($Interval) - 1)
)
| fieldsAdd
    successRatio = successCalls[] / totalCalls[] * 100

 

I hope it helps 😀

Max Lopes

enrico_afkl
Newcomer

that's perfect thanks!

Featured Posts