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

Output of total number of http errors using DQL

Taihei
Frequent Guest

Please tell me how to output the total "reqcount" value in the following DQL.

timeseries reqcount=sum(dt.service.request.count, default:0),
by:{http.response.status_code},
filter:{
dt.entity.service == "XXXXXXX"
and http.response.status_code == 500
}

5 REPLIES 5

andreas_grabner
Dynatrace Guru
Dynatrace Guru

Hi

Have a look at this dashboard on the Playground TEnant - you get a couple of great DQL query examples for e.g: Failure Rate but it also shows some filter options in dashboards: https://wkf10640.apps.dynatrace.com/ui/apps/dynatrace.dashboards/dashboard/29f7a7c0-6c4c-4f02-9a71-a...

 

 

Contact our DevRel team through devrel@dynatrace.com

And to your question. You could use the new Metrics Tile in the Dashboard and easily create that DQL simply through point and click and then also see the DQL

andreas_grabner_0-1727246224652.png

 

 

 

Contact our DevRel team through devrel@dynatrace.com

Taihei
Frequent Guest

Thank you for your help!
I was able to output the total "reqcount" value.

Please tell us the following in addition.

How do I write a DQL statement that returns 0 if there are no records?

I could not write the following, but it's not working.

timeseries reqcount=sum(dt.service.request.count, default:0) ,
by:{http.response.status_code},
filter:{
dt.entity.service == "XXXXXXXXXXXXXXX"
and http.response.status_code == 500
}
| fieldsAdd result=if(arraySum(reqcount) > 0, arraySum(reqcount), else: 0)

You can use nonempty:true parameter for timeseries command to ensure that it always returns something

Taihei
Frequent Guest

Resolved. Thank you very much.

I have created a DQL as follows

timeseries reqcount=sum(dt.service.request.count, default:0) ,
nonempty:true,
by:{http.response.status_code},
filter:{
dt.entity.service == "XXXXXXXXXXXXXXX"
and http.response.status_code == 500
}
| fieldsAdd result=if(arraySum(reqcount) > 0, arraySum(reqcount), else: 0)

Featured Posts