For the last couple of months I’ve been using Application Insights to monitor, detect and diagnose performance issues in our applications.Â Last week I noticed that the Analytics button on the Application Insights blade was working:
Once you click it, your browser will open the Application Insights – Analytics pageÂ with the following taxonomy:
- AÂ left panel (named SCHEMA) which shows all the tables you can use to query the telemetry from your applications.
- AÂ top panel where you must write your queries.
- And a bottom panel to showÂ the query results or charts.
Yes you read it right:Â You can query your telemetry!
To writeÂ your queries you must use the Insights Query Language and startÂ with a source table followed by a series of operators separated by |.
The following example is a simple query that will render a pie chart with the average Requests/Sec served by role instances (servers):
1 2 3 4 5
metrics | where name == "Requests/Sec" | project value, cloud_RoleInstance | summarize avg(value) by cloud_RoleInstance | render piechart
- Line 1 specifies the metricsÂ table as the source of the query.
- Line 2 uses the where operator to filter the table.
- Line 3 selects the columns to include using the project operator.
- Line 4 calculates the average of the metric by cloud_RoleInstance (server)
- Line 5 renders the results as a pie chart.
You must be thinking: do I have to learn another language? The short answer is yes! But it’s nothing you won’t be able to handle and once you get used to it, you willÂ unleash the full power of the queries andÂ gain a betterÂ understanding of your applications.Â For instances now we can answer the following questions:
- What method of our application throws more exceptions?
- What exceptions are related to a given user?
- What pages are being used and which ones are not?
To learn much more you can visitÂ theÂ Queries in Analytics page which is aÂ great resource and is well organized.
Hope it helps.