Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Application Insights Monitoring

I am trying to set up Application Insights on an ASP.NET MVC Web Application and I am not certain on the setup required.

I have added the Application Insights Telemetry SDK for Services NuGet package to my project in Visual Studio 2012.

Can someone confirm if I need both the JavaScript in my HTML:

JS

AND the following code in Global.asax:

protected void Application_BeginRequest(object sender,  EventArgs e)
{
    ServerAnalytics.BeginRequest();
    ServerAnalytics.CurrentRequest.LogEvent(
        Request.Url.AbsolutePath);
}

I currently have both added to the project and I am getting some usage information, but it is not accurate (0 unique users for example).

I was also getting performance data, but this is no longer happening.

I have been using the links below for reference:

http://msdn.microsoft.com/en-us/library/dn481094.aspx
http://msdn.microsoft.com/en-us/library/dn495324.aspx
http://msdn.microsoft.com/en-us/library/dn518124.aspx
http://msdn.microsoft.com/en-us/library/dn481098.aspx

like image 792
philreed Avatar asked Dec 31 '25 08:12

philreed


1 Answers

I would say it depends on your tasks. Use only Javascript code snippet if you need to log event on Client side but use ServerAnalytics.CurrentRequest.LogEvent() if you want to write event on Server side.

like image 187
Alex Boo Avatar answered Jan 02 '26 00:01

Alex Boo