Search Sreeni's Insights

Filter by content type
cloud November 7, 2019 6 min read

How to build useful dashboards with Application Insights? Tools, queries and charts - Part 4

The tools, Kusto queries and dashboard charts which make Application Insights data useful, from web transactions to the application map.

Share:

How to build useful dashboards with Application Insights? Tools, queries and charts - Part 4

Collecting the telemetry is only half of the job, the other half is making use of it. A team which has good data but no dashboards and no alerts will still be reactive, they will come to know about a problem only when the customer calls. In the previous articles, we discussed the instance strategy, the configuration, the sampling and the MI logs. In this article, we are going to see the tools which are available to read the data, and how to build a useful dashboard with the most used charts of an APM tool.

TL;DR Summary

  • Use Visual Studio (F5 Insights, Trends and CodeLens) to spot exactly where an exception got triggered.
  • Application Insights uses Log Analytics as backend, so learn the basics of Kusto query language.
  • Use metrics explorer for the charts which are available out of the box, and Kusto queries for the custom charts.
  • Create alerts and health checks, otherwise we are not proactive.
  • Application Insights doesn’t provide some of the popular APM charts by default, like the Apdex score and the top 5 web transactions, but we can build them.
  • Use Azure dashboard or BI tools like Power BI to share the charts.

Which tools do we have to read the data?

Let us take a closer look at the tools we use day to day,

If you are new to Kusto, the SQL to Kusto cheat sheet is a good place to start with. Also refer the Kusto language reference for the operators, string functions, date time functions, aggregations, joins, JSON data, advanced queries and charts. When your data is spread across more than one instance, the cross resource queries will help.

How to analyze failures and performance issues?

Application Insights has step by step tutorials for the most common investigations. Refer the following links,

How to be proactive with alerts and health checks?

A dashboard needs somebody to look at it. Alerts and health checks make Application Insights tell us before the customer does. Refer alerts to create the metric based alerts and health check monitoring to create the health check and its alerts. Alerts are the way to go from reactive to proactive, so don’t skip them.

How to build a dashboard?

Application Insights comes with a default dashboard (overview), and it also gives a couple of options to create a custom dashboard. Refer this tutorial to create your own.

Compared to some of the dedicated APM tools, Application Insights is slightly lagging on the data projection, and some popular charts are not available out of the box. However, we can customize it and create our own dashboard with Azure dashboard or BI tools like Power BI. The following diagram shows the charts we normally add to a dashboard,

Charts on the Application Insights dashboard
Charts on the Application Insights dashboard

Let us see each chart.

Web transaction time

This is the most useful chart of any APM tool. It shows where the time of a transaction was spent. Application Insights doesn’t provide this chart by default. However, we can use the metrics to plot the server response time and the dependency response time, but it will not be like the stacked chart (server, CLR, database server, cache, etc.).

We can use Log Analytics and Kusto to produce the stacked version, but it needs some advanced knowledge of Kusto. The simple version can be prepared from metrics explorer by adding the following metrics,

  • Dependency duration - Average
  • Server response time - Average

Throughput

This chart plots the requests per minute. Through this chart, we can identify the pattern of the throughput from idle time to peak time. Application Insights provides this chart out of the box, but it will not show the average of the throughput. Add the following metric in metrics explorer,

  • Server requests - Sum

Apdex score

Apdex score is the industry-standard metric that tells the satisfaction level of the users on performance. Application Insights doesn’t provide this chart by default, but we can create our own with the following Kusto query. The threshold is in milliseconds, so change SatisfiedThreshold based on your application,

let SatisfiedThreshold = 200;
requests
| where timestamp > ago(1h)
| extend Day = bin(timestamp, 1m),
    IsSatisfiedUser = (duration < SatisfiedThreshold),
    IsToleratedUser = (SatisfiedThreshold < duration and duration <= 4 * SatisfiedThreshold)
| summarize AvgDuration = avg(duration), AllUsers = count(),
    SatisfiedUsers = countif(IsSatisfiedUser == true),
    ToleratingUsers = countif(IsToleratedUser == true) by Day
| project Day,
    Apdex = (SatisfiedUsers + (ToleratingUsers / 2.0)) / AllUsers,
    SatisfiedUser = 0.8, ToleratedUser = 0.5, FrustratedUser = 0.3
| order by Day
| render timechart

Top 5 web transactions

It helps us to know the most used and the most time consuming transactions of an application. It is not available by default, but we can create it with the following Kusto query,

let dataset = requests
| where timestamp > ago(1h)
| where client_Type != "Browser";
dataset
| summarize Requests = sum(itemCount), Avg = avg(duration) by operation_Name
| union (dataset
    | summarize Requests = sum(itemCount), Avg = avg(duration)
    | extend operation_Name = "Overall")
| top 5 by Requests desc

Error analytics

Error analytics is the most important and useful feature of an APM tool. Application Insights provides some of the charts by default, and we can create a custom chart with Kusto and Log Analytics. Remember that exceptions are not subject to sampling, so these numbers stay reliable.

Hardware

Application Insights gives a holistic view of the hardware performance counters, like CPU time, memory usage and IO usage (disk, network and memory). We use the following metrics,

  • CPU - Process CPU (Average)
  • Memory - Available memory (Average) and Process private bytes (Average)
  • IO - Process IO rate (Average)

Application map

Application map provides a holistic view of all the deployment nodes of an application. In addition to that, it also shows the number of instances on each node, the relation between the nodes, the health status between them, the average response time and the number of calls between two nodes. This is where the readable role name from Part 2 pays off. It can be added to a dashboard from the Azure dashboard tile gallery.

Note: The Application map is only as good as the telemetry behind it. When the role names are not set and the dependencies are not recognized, the map will show generic names.

Wrap up

In this article, we have looked at the tools to read the Application Insights data, how to be proactive with alerts, and how to build a dashboard with the most useful charts. Over the four articles, we covered the instance strategy, the configuration, the data control and the dashboards. I hope this series provided you some insights into implementing Application Insights effectively in your organization. I appreciate your time and efforts to read these articles.

Related Posts