How To Use Azure Application Insights In The Azure Portal - Configuration, And Setup From End-To-End

Introduction 

 
Now let's switch back to application insights in the Azure portal.
 
Learning Series
Enabling application insights for Azure services has two methods, but it's recommended to enable both ways for all your cloud applications.
  1. Application-level activation.
  2. Applying through code using SDK. 
Open your web app services ‘WEB API’. Goto Application Insights section and click on the ‘Turn on Application Insights’ button to enable AI services.
 
How To Use Azure Application Insights In The Azure Portal, Configuration, And Setup From End To End Setup
 
AI Collect application monitoring data using Application Insights option should be set to ‘Enable’
 
How To Use Azure Application Insights In The Azure Portal, Configuration, And Setup From End To End Setup
 
In the next scroll option related to linking application insights or changing existing app insights resource information, it will give information about existing application insights details, because for every Azure app service created, Microsoft provides a default option that creates each application insight for each service.
 
Now link the Application Insights application to the Azure web app, or create it if you are required to, as shown in the below screenshot.
 
How To Use Azure Application Insights In The Azure Portal, Configuration, And Setup From End To End Setup
 
In the ‘Instrument your application’ option, select your application platform as shown options in the below screenshot. In the current example, I’m using .NET Core and enabling the below options for logging collection level, AI SDK, Profiler, Snapshot Debugger, SQL Commands, and local variables for your exceptions in applications
 
Key Features should be enabled for complete usage experience with Application Insights.
  1. Collection Level.
  2. Profiler.
  3. Snapshot debugger.
  4. SQL Commands. 
How To Use Azure Application Insights In The Azure Portal, Configuration, And Setup From End To End Setup
 

Collection Level

 
This option is to enable all level logs like usage trends, I/O memory information for each request, dependencies, exceptions, trace, page view, customs events, availability, etc. 
 

Profiler

 
It will provide a performing time for each and every logic that is in your code.
 
How To Use Azure Application Insights In The Azure Portal, Configuration, And Setup From End To End Setup
 

Snapshot Debugger

 
To use this option, subscription owners should give access for inspecting debugger snapshots. We can assign different users or groups in your active directory by current subscription. If your application has any errors, this snapshot debugger will give a complete view about a failed request (exception) in detail, and provide you a .diagsession file to reproduce the issue again using SDK. To know more about the snapshot debugger we will brief more in the next article.
 
How To Use Azure Application Insights In The Azure Portal, Configuration, And Setup From End To End Setup
 
How To Use Azure Application Insights In The Azure Portal, Configuration, And Setup From End To End Setup
 
Using snapshot debugger, the below roles are required to access for the user level, this snapshot debugger will make sure to provide access to each suitable person because this snapshot debugger (.daigsession) file contains PII (Personal Identity Information) data.
 
How To Use Azure Application Insights In The Azure Portal, Configuration, And Setup From End To End Setup
 
Once the basic setup is done in application insights using the Azure portal, click on ‘View Application Insights data’ to switch to the AI app service.
 
How To Use Azure Application Insights In The Azure Portal, Configuration, And Setup From End To End Setup
 

Application Map

 
Usually, if any developer is new to the on-going project, he gets a complete project mapping and requests flow information from this section. It would be very helpful to understand project architect using Azure cloud services. It will give all your application failure hotspots, dependencies, and health check information from the distributed applications. If your application is the first to Application Insights(AI), the below screen will be shown. Click on ‘Get Started with Application Map’.
 
How To Use Azure Application Insights In The Azure Portal, Configuration, And Setup From End To End Setup
 

Live Metrics

 
It will give live trace information about your application in metric graphs. To observe this live metric functionality, I created one console application to execute the GET Method using a for loop.
 
How To Use Azure Application Insights In The Azure Portal, Configuration, And Setup From End To End Setup
 
In the below screengrab, live metrics graphs are shown.
 
How To Use Azure Application Insights In The Azure Portal, Configuration, And Setup From End To End Setup
 

Application Map

 
Now switch back to the ‘Application Map’ option to check request calls information. Here, only one instance was involved in the above activity (Console Application).
 
How To Use Azure Application Insights In The Azure Portal, Configuration, And Setup From End To End Setup
 
Through console application, we called web API in ‘n’ number of times using loop condition and below application map section shows you the application information which involved from the last hour(You can choose different time range and also custom your time range), method type information, duration, layout design (if more than one app service should be configured to experience about this option). But every time we need to refresh the logs by clicking on the ‘Refresh ’ button and ‘Update map components’ button for the latest execution calls information.
 
How To Use Azure Application Insights In The Azure Portal, Configuration, And Setup From End To End Setup
 

Search

 
The search option will give log information which we configured through the code level. The below screen shows the log information with GUID id. Now click on any log with GUID ID to know end to end involved in transaction and trace details.
 
How To Use Azure Application Insights In The Azure Portal, Configuration, And Setup From End To End Setup
 
End-to-End transaction details for each transaction.
 
How To Use Azure Application Insights In The Azure Portal, Configuration, And Setup From End To End Setup
 
Try each and every highlighted item in the below screengrab to experience how application insights help developers.
 
How To Use Azure Application Insights In The Azure Portal, Configuration, And Setup From End To End Setup
 

Performance

 
In this section, you can watch your app performance along with operation names with execution count.
 
How To Use Azure Application Insights In The Azure Portal, Configuration, And Setup From End To End Setup
 
How To Use Azure Application Insights In The Azure Portal, Configuration, And Setup From End To End Setup
 

Troubleshooting guides

 
All common logs are maintained in the below section.
 
How To Use Azure Application Insights In The Azure Portal, Configuration, And Setup From End To End Setup
 
In the next article, we learn more about alerts, metrics, logs, and workbooks, REST API, Azure DevOps work item automation for every exception triggered in Application Insights.