13 Aug 2024 03:45 PM - last edited on 22 Aug 2024 11:48 AM by MaciejNeumann
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.
Solved! Go to Solution.
13 Aug 2024 04:39 PM
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ő
14 Aug 2024 08:48 AM
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.
19 Aug 2024 07:49 PM - edited 19 Aug 2024 07:56 PM
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:
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?
20 Aug 2024 10:51 AM
@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