15 May 2025 01:26 PM
I want to create a line chart that displays the failed request count for a selected service
I able to achieve the builtin metrics however when i am trying to do same thing with DQL its not returning the result
Able to get result:
builtin:service.errors.total.rate:filter(and(or(in("dt.entity.service",entitySelector("type(service),entityName.contains(~"(/sbmo-auditlogconsole)~")"))))):splitBy("dt.entity.service"):sort(value(auto,descending))
No result with:
timeseries { count = sum(dt.service.request.count, filter: { failed == true }), count.0 = sum(dt.service.request.count) }, by: { dt.entity.service }, filter: { in(dt.entity.service, classicEntitySelector(concat("type(service),entityName.contains(\" (/sbmo-auditlogconsole)\")"))) }
| fieldsAdd rate = count[] / count.0[]
| sort arraySum(rate) desc
| fieldsAdd entityName(dt.entity.service)
| fieldsRemove count.0, count
Solved! Go to Solution.
19 May 2025 07:54 AM
Please try this:
timeseries { count = sum(dt.service.request.count, filter: { failed == true }, default:0),
count.0 = sum(dt.service.request.count) }
, by: { dt.entity.service }
, filter: { in(dt.entity.service, classicEntitySelector(concat("type(service),entityName.contains(\" (/sbmo-auditlogconsole)\")"))) }
, union:true
| fieldsAdd rate = count[] / count.0[]
| sort arraySum(rate) desc
| fieldsAdd entityName(dt.entity.service)
| fieldsRemove count.0, count
Without union:true your query will not return where there was completely no data when condition "failed = true" is not fulfilled.
Additionally adding default:0 will help getting correct result (0) instead of null when there are no failed requests for specific time slots.
19 May 2025 04:15 PM
Thanks, Its working now.