Visual Studio Online is a platform developed by Microsoft that offers a collection of services for software development. Services available are:
In reality Visual Studio Online is a Team Foundation Server in cloud that brings specific benefits of cloud applications (requires no installation, configuration and the maintenance is provided by Microsoft). Users only need to logon to the platform and use it.
Visual Studio Online has also a new application "Application Insight", dedicated to monitoring and collection dates from applications that are running on production environment.
Applications can be monitored can be of the following type:
Next we follow how we configure the Application Insight application for using and how it is provided data for analysis.
To entry in the "Application Insight" we have to login in the Visual Studio Online and from Dashboard click on the link "Try Application Insight" (Understand and optimize the performance of your application).
Next we follow how to configure a web application.
Through a short wizard (Add application) will specify which type of application will be monitored. The user must choose if the application is .Net or Java, if it"s Azure or not if you want to collect data from a server component.
After that, in the next screen, the user specifies a name for the application and receives a configuration file to be copied to the main folder of the web application.
To collect information in real time from the website is necessary to install a desktop application "Microsoft Monitoring Agent" on the computer on which the web application is installed. Also for collecting data about users (operating system, browser, location etc) are required some changes in the application.
So to find out how many times each page has been accessed in the application we have to copy a JavaScript code in the header of each page:
And if we want to have information about the users login and activities, it is necessary that after login to save user information in the appInsights JavaScript object.
All information that is collected through this application can be configured later in that configuration file that was copied to the root of the web application.
The configuration file contains two sections: Production and Development and we can set these properties individually for each profile.
Properties that can be set are:
Proprietate |
Descriere |
Prod |
Dev |
Enabled |
ServerAnalytics attribute node - specifies whether or not the service is enabled data collection |
True |
True |
SendToRawStream |
Send data to the Raw Event tile and Diagnostics/Streaming page |
False |
True |
CollectUserName |
Specifies whether to collect the current user's username |
False |
True |
CollectMachineName |
Collect machine name of the current user |
False |
True |
DataUpload IntervalInSeconds |
The time interval for send data collected (in seconds) |
60 |
0.1 |
AutoFillClient PropertiesFromRequest |
Collect user"s data from HTTP request |
True |
True |
CollectClientIPAddress |
Collect IP address from HTTP request |
True |
True |
There is a version of "Application Insight" integrated with Visual Studio IDE, which can be installed from the "Extensions & Updates" from Visual Studio.
After installation, right click on the desired project and a new options appears for add "Application Insights" to the desired project.
After adding the application to the project, a new application is automatically created in Visual Studio Online that will collect data about the project.
"Application Insight" has 5 main sections that display data collected:
Next we will look at a concrete example and will see how the information is displayed to the user.
The default Dashboard contains 3 widgets: one for Availability, one for Performance and one for Usages. Using this dashboard we can easily see if there are problems in the application.
Only the information occurred in the last 24 hours are displayed initially, but it can easily set a different time interval. We can change to other predefined options: "Last hour", ", "Last 4 hours", "Last 12 hours", "Last 24 hours", "last 3 days", "Last 7 days", and through the option "Custom" you can select any desired time interval (e.g. 1 January to 15 January).
The second tab (Availability) displays a more detailed graphic about application availability.
Here we can define multiple areas to check whether the application is available.
In the example above we defined several areas in the world: Australia, South America (Brazil), Europe (London, Moscow), North America (USA) and Asia (Japan), from where to check if the application is available. It also displays how long the request of each area was, so it can be detect if the application has problems only in a certain area.
There is also the opportunity to define alerts. Thus, if the application is not available in one or more areas, you can specify to send a message (e-mail) to a specified address (or several) in which to notify of the problem. Such a mail is presented below.
This section contains several widgets that provide information about the performance of the application. These widgets helps to identify performance problems encountered in the application.
Widgets that appear by default are:
This page contains useful information about users that accessing the application. We can see here the most accessed pages in the application, how many users have accessed the site, the browser used by the users, the resolution used etc.
At first glance this information seem more useful to the marketing or management department; but may also provide useful information to developers. This can determine whether it is necessary to implement new functionalities (e.g. support for a specific type of browser, resolution or language).
This page presents the various metrics that help diagnose problems that occurred when running the application.
In the default page of this section is displayed a summary of the main events from the application. In the above picture appears only three metrics: exceptions, performance and memory, but other metrics can easily choose from a longer list of predefined metrics provided by Microsoft.
In the next section we will analyze information provided by two of the metrics (exceptions and performance).
Exception events - displays all exceptions that occurred during the execution of the application. In the first step are displayed only the number of exception that occurred in application. If we want to see more information about exception, using the double click we can open a new screen where we see a list of exceptions (description, exception type, computer and date).
If we want to find out more details about an exception by double clicking on the desired error opens a popup where are displayed all information about that exception: parameters, stack, code line.
With this information we can identify easily when the error occurred, we can reproduce it and then we can fix it.
Perf events - displays all performance issues occurred in the application.
As in exceptions widget, if we want to investigate in detail a performance issue, we can enter in the details window where we can find all the information about the issue (parameters, execution time for each method - including SQL code that was executed).
With this information you can easily identify where the application has performance issues and also we can start to fix them.
Another very useful thing supported by "Application Insight" is integration with the application logger. Through a small wizard we can select what logger we use in the application (Log4net, NLog or Trace Listener) and then Visual Studio Online, generates a config to be added in the configuration file of the application.
In this way the information logged in the application will appear in the "Application Insight" from Visual Studio Online.
Gathering information about an application while running is not a simple operation. Until now we could use logging, performance counters etc. However, this requires additional time (performance counters for configuration and analysis; logging - for the data analysis, sometimes we have to look in a few MB text file information to find some useful information to know what happened).
"Application Insight" has the advantage of collecting this information very easily (lose few time to configure) and to present them in a very intuitive format and easy to interpret.