# Perform Dependency Analysis Using DQL for Service Mapping

**URL:** <https://community.dynatrace.com/t/perform-dependency-analysis-using-dql-for-service-mapping/49656>\
**Category:** DQL\
**Tags:** dql, logs\
**Created:** [January 10, 2025, 1:02pm UTC](https://community.dynatrace.com/t/perform-dependency-analysis-using-dql-for-service-mapping/49656 "2025-01-10T13:02:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![m\_zol](https://avatars.discourse-cdn.com/v4/letter/m/51bf81/32.png) [@m\_zol](https://community.dynatrace.com/u/m_zol)\
**Post date:** [January 10, 2025, 1:02pm UTC](https://community.dynatrace.com/t/perform-dependency-analysis-using-dql-for-service-mapping/49656/1 "2025-01-10T13:02:26Z")

</div>

Hello,

I need a DQL to answer the following questions:

- What is the response time, failure count and throughput of **Service B** that is called by **Service A**. The result need to be only for the calls that Service A make to Service B.

I created a DQL that show the services dependency. But could not get the metrics I need.

```markup
fetch dt.entity.service
| expand calledby_service=called_by[dt.entity.service]
| expand calls_service=calls[dt.entity.service]
| fieldsAdd service_type = serviceType, clusteredBy = clustered_by[dt.entity.kubernetes_cluster][0], belongsToNamespace = belongs_to[dt.entity.cloud_application_namespace][0], belongsToApp = belongs_to[dt.entity.cloud_application][0],instantiates= instantiates[dt.entity.service_instance][0]  
| lookup [fetch dt.entity.service], sourceField:calledby_service, lookupField:id, fields:{Incoming=entity.name}
| lookup [fetch dt.entity.service], sourceField:calls_service, lookupField:id, fields:{Outgoing=entity.name}
| lookup [fetch dt.entity.kubernetes_cluster], sourceField:clusteredBy, lookupField:id, fields:{Cluster = entity.name}
| lookup [fetch dt.entity.cloud_application_namespace], sourceField:belongsToNamespace, lookupField:id, fields:{Namespace = entity.name}
| fields service_type, service=entity.name, Incoming ,Outgoing, Namespace, Cluster
| summarize count(), by:{service,Incoming,Outgoing}

```

---

<div class="post-metadata">

**Author:** ![paolo\_fumanelli](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/paolo_fumanelli/32/1037_2.png) [@paolo\_fumanelli](https://community.dynatrace.com/u/paolo_fumanelli)\
**Post date:** [January 10, 2025, 3:38pm UTC](https://community.dynatrace.com/t/perform-dependency-analysis-using-dql-for-service-mapping/49656/2 "2025-01-10T15:38:40Z")

</div>

Unfortunately there is no such metric as far as I know. You can find the relations as you did but can’t filter out a certain service metric based on called/caller service.

---

<div class="post-metadata">

**Author:** ![StrangerThing](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/strangerthing/32/12182_2.png) [@StrangerThing](https://community.dynatrace.com/u/StrangerThing)\
**Post date:** [January 10, 2025, 4:01pm UTC](https://community.dynatrace.com/t/perform-dependency-analysis-using-dql-for-service-mapping/49656/3 "2025-01-10T16:01:11Z")

</div>

Agree you cannot do this in the current state. Although we have a preview of Traces on Grail, in which you’d be able to query the traces/spans that are calling Service B from Service A and can calculate your metrics based on that. We can’t wait for Traces on Grail to be fully released!

---

<div class="post-metadata">

**Author:** ![m\_zol](https://avatars.discourse-cdn.com/v4/letter/m/51bf81/32.png) [@m\_zol](https://community.dynatrace.com/u/m_zol)\
**Post date:** [January 10, 2025, 9:25pm UTC](https://community.dynatrace.com/t/perform-dependency-analysis-using-dql-for-service-mapping/49656/4 "2025-01-10T21:25:40Z")

</div>

We do have access to Traces on Grail in our QA environment. I’m trying a query to get those data but no success yet.

---

<div class="post-metadata">

**Author:** ![paolo\_fumanelli](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/paolo_fumanelli/32/1037_2.png) [@paolo\_fumanelli](https://community.dynatrace.com/u/paolo_fumanelli)\
**Post date:** [January 13, 2025, 10:26am UTC](https://community.dynatrace.com/t/perform-dependency-analysis-using-dql-for-service-mapping/49656/5 "2025-01-13T10:26:14Z")

</div>

I also tried on playground but couldn’t find a solution yet.

---

<div class="post-metadata">

**Author:** ![krzysztof\_hoja](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/krzysztof_hoja/32/34625_2.png) [@krzysztof\_hoja](https://community.dynatrace.com/u/krzysztof_hoja)\
**Post date:** [January 13, 2025, 1:08pm UTC](https://community.dynatrace.com/t/perform-dependency-analysis-using-dql-for-service-mapping/49656/6 "2025-01-13T13:08:43Z")

</div>

You may check this thread with some hints and query examples:

[https://community.dynatrace.com/t5/DQL/DQL-on-spans-variant-for-called-by-analysis/m-p/248551/highlight/true#M994](https://community.dynatrace.com/post/248551)
