With the arrival of the Cloud, many things have changed. One of them is the way in which the application is developed and monitored. Traditionally, when any development was carried out, we introduced a log into that application (libraries such as NLog, Log4Net, etc. are well known). But now, times have changed. Now we develop for any application and any device, which forces us to have some mechanism by which we can monitor our application once (even while in production) .
In Azure we have the Application Insight service. It is an extensible analysis service that monitors your active application. It helps you detect and diagnose performance problems and understand what users really do with your application. It is designed for developers, to help them continuously improve the performance and ease of use of the application.
But it is also possible to use it for marketing work. Usage patterns can be analyzed to understand user needs and continuously improve the application.
- Reviews of page views, new and recurring users, geographic location, platforms and other main usage statistics.
- Track usage paths to assess the success of each feature.
They can detect, evaluate and diagnose performance problems and correct them before most users realize it.
- Alerts about performance changes or blockages.
- Metrics to help diagnose performance problems, such as response times, CPU usage or dependency tracking.
- Availability tests for web applications.
- Reports and alerts of exceptions and blockages.
- Effective search for diagnostic records (which includes record tracking of your favorite record frames).
Besides this service, it is possible to use it on many platforms. Applicattion Insigh is an SDK available for ASP.NET servers, Azure Services, J2EE Servers, Web Pages, Windows Phone, Xamarin, Joomla, SharePoint, NodeJS, etc. That is to say, a wide range independent almost of the platform in which you are developing.
Practical Example: Use Application Insight in ASP.NET
1. Creating resources in Application Insights
Log in to the Azure Portal and create a new Application Insights resource. Choose ASP.NET as the type of application.
Once the resource is created, take the Key Instrumentation to use it in our application.
2. Install the SDK in your application.
Install and configure the Application Insights SDK, it varies depending on the platform on which you work. In the case of ASP.NET applications it is easy.
In Visual Studio, edit the NuGet packages of your web application project. Install the Application Insights SDK for web applications.
Edit ApplicationInsights.config (which the NuGet installation added).
PD: It is also possible to add this service from the creation of the project by activating a check to use Insights.
3. Execution of the project
Use F5 to run the application and test it. Open several pages to generate telemetry. In Visual Studio, a count of the events that have been sent will appear.
4. Telemetry display
Go back to the Azure Portal and look for the Application Insights resource. From the same we have many options from the number of accesses to the application, such as the response time of the application or even since browsers are accessing our application.
Finally, this information can be exploited according to our needs by exporting this data to a PowerBI panel.
5. Event customization
Once we add to our HDInsights application, the service already has a large amount of data that the SDK sends by default and, in many cases, it may be sufficient.