# Service Failure rate by host

**URL:** <https://community.dynatrace.com/t/service-failure-rate-by-host/55604>\
**Category:** DQL\
**Tags:** dql, services\
**Created:** [April 16, 2026, 3:50pm UTC](https://community.dynatrace.com/t/service-failure-rate-by-host/55604 "2026-04-16T15:50:51Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmistry](https://avatars.discourse-cdn.com/v4/letter/j/d6d6ee/32.png) [@jmistry](https://community.dynatrace.com/u/jmistry)\
**Post date:** [April 16, 2026, 3:50pm UTC](https://community.dynatrace.com/t/service-failure-rate-by-host/55604/1 "2026-04-16T15:50:51Z")

</div>

Hello,

Is there a way where i can see service failure rate but have it split by host.&nbsp;  
we have the same services on multi different host and want to see all services on all host and their failure rate?

Maybe a DQL query?

for example:

| Host | Service | Failure Rate |
| --- | --- | --- |
| Server111 | Service111 | |
| Server111 | Service222 | |
| Server222 | Service111 | |
| Server222 | Service222 | |

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [April 16, 2026, 4:36pm UTC](https://community.dynatrace.com/t/service-failure-rate-by-host/55604/2 "2026-04-16T16:36:33Z")

</div>

You can see that directly in the services app in Failures tab.&nbsp; [Playground link .](https://playground.apps.dynatrace.com/ui/apps/dynatrace.services/failure-analysis?tf=2026-04-16T15%3A58%3A03.456Z%3B2026-04-16T16%3A33%3A06.849Z&groupedByColumns=dt.entity.service.entity.name%2Chttp.request.header.host)

You can adjust grouping as necessary. You can also grab SQL from there.

---

<div class="post-metadata">

**Author:** ![t\_pawlak](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/t_pawlak/32/14991_2.png) [@t\_pawlak](https://community.dynatrace.com/u/t_pawlak)\
**Post date:** [April 17, 2026, 7:25am UTC](https://community.dynatrace.com/t/service-failure-rate-by-host/55604/3 "2026-04-17T07:25:59Z")

</div>

Hi,  
try this:

```markup
fetch spans, from:now()-2h, to:now()
| filter request.is_root_span == true
| filter isNotNull(dt.entity.host) and isNotNull(dt.entity.service)
| summarize 
    failed = countIf(request.is_failed == true),
    total = count(),
  by: { dt.entity.host, dt.entity.service }
| fieldsAdd 
    host = entityName(dt.entity.host),
    service = entityName(dt.entity.service),
    failure_rate = 100.0 * failed / if(total == 0, 1, else: total)
| fields host, service, failure_rate
| sort failure_rate desc

```

you should recive this:

 ![host,service,failurate.jpg](https://global.discourse-cdn.com/dynatrace/original/2X/7/7b798c7349189f37976135b9b7206d9ac03663fb.jpeg)

---

<div class="post-metadata">

**Author:** ![jmistry](https://avatars.discourse-cdn.com/v4/letter/j/d6d6ee/32.png) [@jmistry](https://community.dynatrace.com/u/jmistry)\
**Post date:** [April 17, 2026, 8:09am UTC](https://community.dynatrace.com/t/service-failure-rate-by-host/55604/4 "2026-04-17T08:09:19Z")

</div>

Ive had a look at this but when i go to find “Host” in Group by it doesnt appear.

---

<div class="post-metadata">

**Author:** ![jmistry](https://avatars.discourse-cdn.com/v4/letter/j/d6d6ee/32.png) [@jmistry](https://community.dynatrace.com/u/jmistry)\
**Post date:** [April 17, 2026, 8:20am UTC](https://community.dynatrace.com/t/service-failure-rate-by-host/55604/5 "2026-04-17T08:20:19Z")

</div>

Hi,

Thank you for this. this has worked but Is there a way you can convert this to timeseries please? i have tried but i get no records coming.

Thanks

---

<div class="post-metadata">

**Author:** ![t\_pawlak](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/t_pawlak/32/14991_2.png) [@t\_pawlak](https://community.dynatrace.com/u/t_pawlak)\
**Post date:** [April 17, 2026, 9:04am UTC](https://community.dynatrace.com/t/service-failure-rate-by-host/55604/6 "2026-04-17T09:04:05Z")

</div>

Yes, because your working query starts from fetch spans, you should use makeTimeseries, not timeseries.  
timeseries is the starting command for metrics, while makeTimeseries is the command used after fetching records such as spans. Dynatrace also notes that for spans, makeTimeseries uses the start\_time field automatically.  
try this:

```markup
fetch spans, from:now()-2h, to:now()
| filter request.is_root_span == true
| filter isNotNull(dt.entity.host) and isNotNull(dt.entity.service)
| makeTimeseries {
    failed = countIf(request.is_failed == true),
    total = count()
  },
  by:{dt.entity.host, dt.entity.service},
  interval: 5m
| fieldsAdd host = entityName(dt.entity.host),
            service = entityName(dt.entity.service),
            failure_rate = if(total[] == 0, 0.0, else: 100.0 * failed[] / total[])
| fields timeframe, interval, host, service, failure_rate

```

---

<div class="post-metadata">

**Author:** ![jmistry](https://avatars.discourse-cdn.com/v4/letter/j/d6d6ee/32.png) [@jmistry](https://community.dynatrace.com/u/jmistry)\
**Post date:** [April 17, 2026, 9:41am UTC](https://community.dynatrace.com/t/service-failure-rate-by-host/55604/7 "2026-04-17T09:41:32Z")

</div>

Hi,

Thank you for this, this has worked and can put it as a graph. Is there a way we can help reduce the cost for this by doing it a different way as at the minute it is scanning over 100gb and will require it to run quite often?

I tried this query but it doesnt give me all services on all hosts like yours does.

timeseries {  
operand1 = sum(dt.service.request.failure\_count),  
operand2 = sum(dt.service.request.count)  
}, by: { dt.entity.service}, nonempty:true  
| fieldsAdd failureRate\_timeseries = operand1[] / operand2[] \* 100  
| fieldsRemove operand1, operand2 | fieldsAdd metricName = “Failure rate”  
| fieldsadd service\_name = entityName(dt.entity.service)  
| lookup [fetch dt.entity.host  
| fields hostid = id, hostname = entity.name, serviceid = runs[dt.entity.service]  
| expand serviceid], lookupField:serviceid, sourceField:dt.entity.service  
| fieldsRemove dt.entity.service, metricName, lookup.hostid, lookup.serviceid

---

<div class="post-metadata">

**Author:** ![t\_pawlak](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/t_pawlak/32/14991_2.png) [@t\_pawlak](https://community.dynatrace.com/u/t_pawlak)\
**Post date:** [April 17, 2026, 9:50am UTC](https://community.dynatrace.com/t/service-failure-rate-by-host/55604/8 "2026-04-17T09:50:50Z")

</div>

Hmmmm,  
IMO, the best way to reduce cost is to stop querying raw spans repeatedly and instead extract a metric from spans and query that metric afterward.  
Right now this query works, but it scans a lot of trace data each time. Dynatrace’s own direction is that for this kind of use case, you should use OpenPipeline metric extraction from spans. That gives you a metric you can later query with cheap timeseries instead of repeatedly scanning large amounts of span data.

---

<div class="post-metadata">

**Author:** ![jmistry](https://avatars.discourse-cdn.com/v4/letter/j/d6d6ee/32.png) [@jmistry](https://community.dynatrace.com/u/jmistry)\
**Post date:** [April 17, 2026, 9:53am UTC](https://community.dynatrace.com/t/service-failure-rate-by-host/55604/9 "2026-04-17T09:53:33Z")

</div>

Perfect, Thank you for your help on this. Much appreciated.&nbsp; Will you be able to show me how to do this via openpipeline please?

---

<div class="post-metadata">

**Author:** ![t\_pawlak](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/t_pawlak/32/14991_2.png) [@t\_pawlak](https://community.dynatrace.com/u/t_pawlak)\
**Post date:** [April 17, 2026, 10:11am UTC](https://community.dynatrace.com/t/service-failure-rate-by-host/55604/10 "2026-04-17T10:11:36Z")

</div>

try this:  
[Calculated metrics for services](https://docs.dynatrace.com/docs/observe/application-observability/services/calculated-service-metric)&nbsp;  
and  
[Extract metrics from spans and distributed traces](https://docs.dynatrace.com/docs/platform/openpipeline/use-cases/tutorial-extract-metrics-from-spans)

---

<div class="post-metadata">

**Author:** ![jmistry](https://avatars.discourse-cdn.com/v4/letter/j/d6d6ee/32.png) [@jmistry](https://community.dynatrace.com/u/jmistry)\
**Post date:** [April 17, 2026, 11:02am UTC](https://community.dynatrace.com/t/service-failure-rate-by-host/55604/11 "2026-04-17T11:02:53Z")

</div>

Thank you for this. appreciate it
