I have asp.net web APIs.I want to write a query in the Azure portal which should show the API endpoints usage by percentage. So that I will know which endpoints are called most and which are called less.
I have written the below KQL query, But it gives the below error when I run it.
Query:
requests
| summarize count() by operation_Name
| extend percentage = todouble(count_) * 100.0 / todouble(todynamic(summarize count()))
| project operation_Name, percentage
| order by percentage desc
Error:
Query could not be parsed at 'summarize' on line [3,73]
Token: summarize Line: 3 Position: 73 If the issue persists, please open a support ticket. Request id: 8727eeab-aa0a-4ef5-a7e4-58e699419cdd
your attempt to use the summarize
operator inside the todynamic()
function is odd/wrong.
if I understood your verbal description correctly, you may the find the following useful - using toscalar()
:
requests
| summarize count() by operation_Name
| extend percentage = 100.0 * count_ / toscalar(requests | count)
| project operation_Name, percentage
| order by percentage desc