cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Pro-Tip: DQL Query Snippets Collection

r_weber
DynaMight Champion
DynaMight Champion

I started to collect various useful DQL query snippets to make it easier for users to get started with DQL. Internally I did this on a notebook, but I also wanted to share this with the community and lete everybody contribute their snippets as well. So why not on an ongoing thread here.

One reply for each snippet and use case, with a little description and a screenshot.

Certified Dynatrace Master, Dynatrace Partner - 360Performance.net
2 REPLIES 2

r_weber
DynaMight Champion
DynaMight Champion

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

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

r_weber_1-1725607962464.png

 

DQL Query:

 

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

 

 

Certified Dynatrace Master, Dynatrace Partner - 360Performance.net

samgar-kali
Dynatrace Enthusiast
Dynatrace Enthusiast

Running operations in DQL with several metrics

samgarkali_0-1725985511937.png

timeseries {
  {used=avg(dt.host.memory.used)},
  {available=avg(dt.host.memory.avail.bytes)}
}, by:{dt.entity.host}
| fieldsAdd total = (used[] + available[])
| fieldsAdd used_percentage = (used[] / total[] * 100)
| fieldsRemove used, available, total



 

 

 

Featured Posts