# Pro-Tip: DQL Query Snippets Collection

**URL:** <https://community.dynatrace.com/t/pro-tip-dql-query-snippets-collection/47517>\
**Category:** Dynatrace Tips\
**Tags:** dql\
**Created:** [September 6, 2024, 7:22am UTC](https://community.dynatrace.com/t/pro-tip-dql-query-snippets-collection/47517 "2024-09-06T07:22:05Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![r\_weber](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/r_weber/32/24884_2.png) [@r\_weber](https://community.dynatrace.com/u/r_weber)\
**Post date:** [September 6, 2024, 7:31am UTC](https://community.dynatrace.com/t/pro-tip-dql-query-snippets-collection/47517/2 "2024-09-06T07:31:00Z")

</div>

**Honeycomb representation of specific service’s health status**

This code snippet creates a honeycomb visualization (like we had on old dashboards) of the service health status. It uses a) the service entity information and the existing davis problem events and combines them. You can filter services by tags (e.g. a dt.owner tag).

 ![r_weber_0-1725607634976.png](https://global.discourse-cdn.com/dynatrace/original/3X/1/7/17028576fe62f0a0f6bdb51c14e06cb1d8bfedae.png)

To get red/green status indicators, set the color mapping in the honeycomb visualization:

 ![r_weber_1-1725607962464.png](https://global.discourse-cdn.com/dynatrace/original/3X/e/a/ea60ef1f25e48155dabee96c06e91d6ad7c80b97.png)

DQL Query:

```java
fetch dt.entity.service, from: -30m
| filter arrayIndexOf(entityAttr(type:"dt.entity.service",id, "tags"),"dt.owner:purchase") > -1 
| join [ fetch dt.davis.events
         | filter arrayIndexOf(affected_entity_types,"dt.entity.service") > -1
         | filter event.status != "CLOSED"
         | expand affected_entity_ids
         | fieldsKeep event.status, affected_entity_ids
         | summarize affected_entity_id=takeFirst(affected_entity_ids), by: {event.status, affected_entity_ids}
       ],
       kind:leftOuter,
       on: left[id] == right[affected_entity_id]
| fieldsAdd health=if(isNull(right.event.status),"OK",else: "NOT OK")
| fieldsRename service=entity.name
| fieldsKeep service,id,health
| sort service asc

```

---

_[View the full topic](https://community.dynatrace.com/t/pro-tip-dql-query-snippets-collection/47517)._
