Observability with Application Insights and the Kusto Query Language (KQL) - introduction
Posted
3 min read
Efficient monitoring and gathering insights are vital for maintaining robust and high-performing applications. If you are hosting your applications in Azure, then it is a good idea to get familiar with Application Insights and what it has to offer. Application Insights gives us the ability to gain deep insights into our applications' performance and health but can also allow us to proactively identify and address issues (and hopefully) before they impact end-users.
What is Azure Application Insights?
Application Insights is a performance management (APM) service that helps developers to monitor and gain insights into their applications. It is suitable for all types of applications such as: web applications, APIs, microservices etc. Application Insights provides a unified platform for tracking and analyzing telemetry data.
Some key features that are worth mentioning:
Telemetry Data Collection: Application Insights can automatically collect telemetry data, including requests, traces, exceptions, and dependencies.
End-to-End Tracing: Tracing requests as they move through various components of your application, particularly useful for the identification of bottlenecks and performance issues.
Dependency Tracking: Monitor dependencies on external services (nice to have for example when you want to identify any bottlenecks or failures in these interactions.)
Exception Tracking: Capture and analyze exceptions to resolve issues in your code.
Custom Events and Metrics: Define custom events and metrics to track application-specific data and performance indicators.
Application Insights support many different languages, see more in the official documentation here https://learn.microsoft.com/en-us/azure/azure-monitor/app/app-insights-overview#supported-languages
Check the official documentation on how easily you can get up and running with application insights in your applications: https://learn.microsoft.com/en-us/azure/azure-monitor/app/opentelemetry-enable?tabs=aspnetcore#enable-azure-monitor-opentelemetry-for-net-nodejs-python-and-java-applications
Introduction to Kusto Query Language (KQL)
The built-in Application Insights dashboard in the Azure portal has a lot of information, but sometimes you want to customize what data you want to see and how. The true power in using Application Insights in Azure lies in the ability to perform advanced analytics and create custom visualizations using the Kusto Query Language (KQL). We will just take a quick look at what KQL is, and in future posts we will dig into more concrete examples of queries that I've worked with.
Here's a very basic example of a simple KQL query for counting requests:
requests | count
Some key features of KQL:
Tabular Data Model: KQL operates on a tabular data model, treating data as tables with rows and columns. This makes it easy to filter, "project", join, and manipulate data as you wish in your queries
Rich Set of Functions: KQL comes with a lot of different functions to perform advanced operations on data. Some examples are: aggregations, mathematical calculations, string manipulations, date-time functions etc.
SQL-Like Syntax: KQL has an SQL-like syntax and is easy to get started with
Building "Dashboards" and "Workbooks" in Azure
Dashboards
Azure Dashboards makes it possible to aggregate and display metrics etc in a single, customizable view. You can also visualize the result of KQL queries in your dashboard making it very powerful.
Workbooks
Azure Workbooks enables you to create interactive reports for your data. You can use KQL queries to populate workbooks with dynamic content, and set up charts based to set up a report that fits your needs.
That's it for now! Please stay tuned for the part of our series on Application Insights and KQL, where we'll dive deeper into advanced KQL techniques, custom visualizations etc...
See you later!