Reputation: 161
I want to show amount of total requests, and the total of the failing requests that are being tracked by ApplicationInsights. When there are no failing requests in the table, the query will return an empty object (via API, in the portal it will say: ' NO RESULTS FOUND 0 records matched'.)
I've tried setting up a variable which is 0 and give it a new value in the join. Also I tried to check if the join value is null or empty and gave it a 0 value when so. But none did help.
requests
| where timestamp > ago(1h)
| summarize totalCount=sum(itemCount) by timestamp
| join (
requests
| where success == false and timestamp > ago(1h)
| summarize totalFailCount =sum(itemCount) by timestamp
) on timestamp
| project timestamp, totalCount, totalFailCount
What I want as a result that if there are no failing requests, totalCount
should display 0
Upvotes: 0
Views: 160
Reputation: 7608
It seems that you do not need a join in this case, if you aggregate by timestamp you will get the buckets based on the actual values in this column, most people usually like to count by time "buckets" for example one minute, here is an example for that:
requests | where timestamp > ago(1h) | summarize totalCount=count(), totalFailCount = countif(success == false) by bin(timestamp, 1m)
Upvotes: 1