What is Azure Application Insights
Application Insights is a service that is a feature of an Azure Monitor service and is used especially in the field of Application Performance Management (APM).
App Insights, one of the most important services of the Azure platform, allows you to monitor your applications live. It automatically tracks performance problems, performance metrics, session information and many metrics for you. It is a service that we can easily apply in almost all our applications as it is very easy to integrate into applications and does not bring workload.
App Insights Collect Which Telemetries
Azure Application collect for us in our live environment applications;
- Incoming Requests, Response Times, Error responses and error types
- Number of Requests Sent, Response Times, Request error returns and numbers
- Inner Exceptions
- Page views and load times
- AJAX calls
- User and session data
- Performence Metrics
- Host information and logs
- Application diagnostic logs
- Custom Telemetries
It monitors such parameters.
How Can I See My Metrics And Where
We need to access the Azure Portal to see our App Insights data. When we select our service on Azure Portal, we will see a tab called Investigate from the left menu. If we need to explain what we see in this tab:
- Application Map : Components of our apps with important metrics
- Smart Detection : It is a feature that we can create an alert mechanism when there is an action other than this pattern by determining a specific pattern.
- Live Metrics : A feature that we can monitor our metrics such as instantly incoming / outgoing request numbers, response time, error numbers and types of our live application.
- Search : A feature that we can search to capture a special log or event.
- Availability : A screen showing the servers and health conditions on which the application runs.
- Failures : Detailed log information that can show up to the codes of faulty requests and internal errors in our application
- Performance : Display showing performance metrics of the application both on request basis and infrastructure utilization
- Troubleshooting guides : A service that takes you to a gallery that shows which metrics to look for in a particular error. It can produce custom screens for us.
Under the monitoring tab, we can look at our metric charts, define Alert rules, and integrate with Log analytics.
Another important tab is the Usage Tab. In this tab, we can access information such as session information, in-app navigation, how long they spent, where they accessed, from users who access our application. Also, we can design the screens that are not in the menu or we want from the More tab.
Sample Usage With Application
We are running the command. By running this, we can load our library inside with the following code block.
After this process, we can create and collect metrics as we want. The following example shows an example of how to create a custom telemetry:
In .Net Core or .Net Framework, from Nuget Package Manager for App Insights; Just install Microsoft.ApplicationInsights.AspNetCore. After that, we need to give the following command in the Startup.cs file for our application to run this service.
Finally, to associate with our Azure service, we enter our instrumental key in our Appsettings.json file as follows:
After this command, we will automatically be able to see our data from Azure Portal. App Insights is a service that can be written on pages by frankly if you want to explain it, but in the simplest form it will be sufficient to explain the setup and what it does.