How To Download Arm For App Insights
Azure Application Insights with App Service — ENABLE ALL THE THINGS
Recently I had to diagnose an issue with an ASP.NET web application running in Azure App Service; utilising Azure Application Insights. After resolving the issue, it came to light that some of the newer features of Application Insights could have helped me work out what was going on.
After I went through the process of enabling these new features, I thought that I would put a list together, not only to remind myself in the future, but to help anyone else interested.
Getting started
As I mentioned I w a s working with an existing application, but if you are starting from scratch here is quick set up.
Infrastructure
This ARM template creates an Azure App Service linked together with Azure Application Insights.
Code
Keeping things simple, launch Visual Studio and create a new ASP.NET Web Application (.NET Framework) and choose MVC.
Now we are ready to …
Infrastructure — Enable the Application Insights Profiler
The Application Insights Profiler lets you view performance profiles of live requests that were served by an application. It also highlights the hot paths that use the most time.
This is a site extension that you can add using ARM:
This extension depends upon having an App Setting named APPINSIGHTS_INSTRUMENTATIONKEY with the Instrumentation Key as its value. Putting this altogether looks as follows:
NOTE — A depends on reference to the site extension has been added to the App Settings defintion. This has been added in order that the site extension gets installed before the App Settings are applied; since App Settings changes restart the App Service and this will cause the site extension install to be cancelled.
Code – Configure Application Insights
The ASP.NET project needs to be configured with Application Insights which can be done using Visual Studio.
Open the project with Visual Studio, and when loaded right click on the project and select the "Configure Application Insights…" option. A simple wizard should open up and just keep clicking next.
This wizard does the following:
- Installs the Microsoft.ApplicationInsights.Web Nuget package.
- Adds a configured ApplicationInsights.config file.
- Adds a custom HandleErrorAttribute to catch and log unhandled exceptions.
- Configures the new attribute as a global filter.
Code – Configure Application Insights for Web pages
Application Insights also allows monitoring at the client side which includes timings of page loads and AJAX calls, counts and details of browser exceptions and AJAX failures, as well as users and session counts.
To set up, you just need to add the SDK to the Shared Layout page which is detailed here.
Code – Enable Snapshot Debugging
I have saved the best for last – Snapshot debugging. When this is enabled, anytime an exception occurs (say in your production web app) it automatically collects a debug snapshot.
You can then view this snapshot either in the Azure Portal or Visual Studio, it shows your code with all the state and variables at the moment the exception was thrown.
The full setup guide can be found here.
There you have it, all configured.
If you want a quick way to do the above at Build 2018, Microsoft announced enhancements to the Azure Portal that allow you to easily enable the Profiler and Snapshot debugging, detailed here.
Extra– Use Release Annotations
One additional thing that you can do as part of your deployment process is to use Release Annotations. Release annotations appear in Metrics graph and can make it easy to see whether recent changes have had any effect on an application's performance
How To Download Arm For App Insights
Source: https://jonjam.medium.com/azure-application-insights-with-app-service-enable-all-the-things-e3c7e13546bf
Posted by: salinasformselly97.blogspot.com
0 Response to "How To Download Arm For App Insights"
Post a Comment