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

SLO using a calculated service metric with no data result in an error - any workaround?

rsmsdk
Helper

Hi

I have a calculated service metric that track a key request count with a processing time of >10 seconds.

I want to use this metric in a SLO to track how many of the total key request are within a timeout limit set in an application. 

The problem occur when no requests have a processing time of > 10 seconds, and the metrics return "no data" which in return causes my SLO to fail instead of showcasing 100%. 

Obviously the metric expression can not use null or zero in the definition, so I was wondering if there is another way to get the result om looking for?

Metric expression:
((calc:service.total-request.count":splitBy()-calc:service.custom-metric-bad-request-count":splitBy())/calc:service.total-request-count":splitBy())*100

When calc:service.custom-metric-bad-request-count have data, the metric express produces the SLO output I'm looking for, but when calc:service.custom-metric-bad-request-count dont have any data the SLO fail.

Thank you in advance.

Copenhagen - Denmark
4 REPLIES 4

Mizső
DynaMight Guru
DynaMight Guru

Hi @rsmsdk,

Have you tired the default transformation? (your expression above):default(100)

Metrics API - Metric expressions - Dynatrace Docs

Metric selector conversion guide - Dynatrace Docs

I hope it helps.

Best regards,

Mizső

Dynatrace Community RockStar 2024, Certified Dynatrace Professional

Thank you so much for taking the time to provide an answer.

I tried adding :defualt(0) to my calculated metric that lack data, but it does not work. I can then add :defualt(0,always) like suggested in this thread on the same topic, but the math does not add up.

I can isolate the individual metrics, and get a confirmation on the data, but when I set up the expression for calculation, the result does not match.

I can setup calc:service.custom-metric-bad-request-count":splitBy():default(0, always) by itself and display zero, but when I try to setup the expression the output is wrong.

An example with values could be ((200-0)/(200))*100

Red = Calculated metric with no data and the addition of :default(0, always)
Green = Total count

Obivously this should output 100, but it does not. It output a number that is nowhere close.

Copenhagen - Denmark

I have the same problem, I need to bring a calculated metric of no response (another item that is not included) and when I try to remove the SLO, it breaks the entire expression.

Send some examples of my problem:

fpereira22_0-1724093585910.png

fpereira22_1-1724093628045.png

fpereira22_3-1724093750691.png

 


fpereira22_2-1724093653923.png



calc:service.statuscode_noresponse_loyalty:splitby() = 4 counts

calc:service.statuscode_noresponse_loyalty:splitby():default(0,always) = 4 counts

(1)+(calc:service.statuscode_noresponse_loyalty:splitby()) = 5 counts
(1)+(calc:service.statuscode_noresponse_loyalty:splitby():default(0,always)) = 124 counts?????

Does anyone have any suggestions?

paulo_calaxa
Helper

@rsmsdk @fpereira22 
Because of having a calculated, or just because of having different metrics, it must be applying a different aggregation from the intended...
Apply a Fold transformation. For instance:

(
(builtin:service.requestCount.total:value:splitBy() - calc:service....:value:splitBy():default(0,always)):fold(value) / builtin:service.requestCount.total:value:splitBy():fold(value)
)
* 100

Featured Posts