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

Show service name on DQL Query

soportetr
Organizer

Hi everyone,

I am running a DQL query that shows which services call other services and which are called by another. Below I leave the query and the result:

Captura de pantalla 2024-10-16 072923.png


What I need to know is that if there is a way to show the names of the services and not the ID's of the services.

Thanks in advance

3 REPLIES 3

michal_lewi
Helper

Hello @soportetr,

you can use lookup function:

 

fetch dt.entity.service
|fieldsAdd entity.customized_name
|fieldsAdd called_by,calls
|filter isNotNull(entity.customized_name)
|expand service1 = called_by[dt.entity.service]
|expand service2 = calls[dt.entity.service]
|fieldsAdd service1name = lookup([fetch dt.entity.service],
sourceField:service1 , lookupField:id)[entity.name]
|fieldsAdd service2name = lookup([fetch dt.entity.service],
sourceField:service2 , lookupField:id)[entity.name]

Best Regards

Michał

You could slightly simplify the above down using the entityName command. It would look something like:

fetch dt.entity.service
|fieldsAdd entity.customized_name
|fieldsAdd called_by,calls
|filter isNotNull(entity.customized_name)
|expand service1 = called_by[dt.entity.service]
|expand service2 = calls[dt.entity.service]
|fieldsAdd service1name = entityName(service1, type:"dt.entity.service")
|fieldsAdd service2name = entityName(service2, type:"dt.entity.service")

 There is that command as well as entityAttr used for extracting entity attributes. Docs for which can be found here: https://docs.dynatrace.com/docs/platform/grail/dynatrace-query-language/functions/general-functions#...

 

Hi, 

I have already managed to visualize the names of the services. But now it is showing duplicate data. I have tried using dedup, but it is still showing duplicate data.

 

Featured Posts