# Retrieve Services with Request Names and Failure Rates Using DQL

**URL:** <https://community.dynatrace.com/t/retrieve-services-with-request-names-and-failure-rates-using-dql/49601>\
**Category:** DQL\
**Tags:** dql, management-zones, services, request-attributes\
**Created:** [January 7, 2025, 7:50pm UTC](https://community.dynatrace.com/t/retrieve-services-with-request-names-and-failure-rates-using-dql/49601 "2025-01-07T19:50:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![harry22](https://avatars.discourse-cdn.com/v4/letter/h/7ab992/32.png) [@harry22](https://community.dynatrace.com/u/harry22)\
**Post date:** [January 7, 2025, 7:50pm UTC](https://community.dynatrace.com/t/retrieve-services-with-request-names-and-failure-rates-using-dql/49601/1 "2025-01-07T19:50:39Z")

</div>

Hi Team,

I am looking for a way in DQL to get the list of services with the request names and failure rate for that request based on management zone or/and tags. And, then compare it with previous week to get the list of requests for which failure rate has increased.

Sample:

// calculate HTTP 5xx response status code request rate. We are looking for each endpoints and interval of 1 day  
timeseries {total = sum(dt.service.request.count),by: { endpoint.name}, interval:24h }, from:-7d, to:-1d  
//filtering out the Non Key requests and including the requests that has “connected” in them  
| filterOut contains(endpoint.name, “NON\_KEY”)

// **Instead of end point name I would like to have a management zone filter below and would also like to include 4xx errors**  
| Filter contains(endpoint.name, “ABC”) or contains(endpoint.name, “DEF”)

//joining the metrics to calculate the error rate  
| join [  
timeseries {fiveXX = sum(dt.service.request.count, default: 0.0), by: { endpoint.name}, interval:24h}, from:-7d, to:-1d,  
filter:http.response.status\_code \>= 500 //filtering for 5xx errors  
and http.response.status\_code \<= 599  
and contains(endpoint.name, “connectedhome”) or contains(endpoint.name, “browsebuy”)  
//], kind:leftOuter, prefix: “httpState.”, on:{ timeframe, endpoint.name }  
], kind:inner, prefix: “httpState.”, on:{ timeframe, endpoint.name }

| fieldsAdd {rate5xx = httpState.fiveXX[] / total[] \* 100} //rate calculation  
/\*  
| filter rate5xx[0] \> 0.0  
and rate5xx[1] \> 0.00  
and rate5xx[2] \> 0.00  
and rate5xx[3] \> 0.00  
and rate5xx[4] \> 0.00  
and rate5xx[5] \> 0.00  
and rate5xx[6] \> 0.00//only rate \> 0.0  
\*/

| fieldsAdd minusSixRate = rate5xx[0],  
todayRate = rate5xx[6] //assigning rates for the days  
| filter minusSixRate != 100.00 and todayRate != 100.00

| fields endpoint=endpoint.name, Last\_Week\_Rate=minusSixRate, Yesterday\_Rate=todayRate, Total\_Req\_Yesterday=total[6], Total\_Failed\_Yesterday=httpState.fiveXX[6]  
| sort Yesterday\_Rate desc

Any help is appreciated. Thanks.

---

<div class="post-metadata">

**Author:** ![MaciejNeumann](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@MaciejNeumann](https://community.dynatrace.com/u/MaciejNeumann)\
**Post date:** [May 15, 2025, 9:19am UTC](https://community.dynatrace.com/t/retrieve-services-with-request-names-and-failure-rates-using-dql/49601/2 "2025-05-15T09:19:17Z")

</div>

Hello&nbsp;[@harry22](https://community.dynatrace.com/user/68729),

Could you check out this Community thread?  
[Filter by Management Zone using DQL](https://community.dynatrace.com/post/232268)&nbsp;  
There are a couple of examples there that potentially can help to solve your use case.
