This is a migrated thread and some comments may be shown as answers.

How to?? asp.net

10 Answers 108 Views
Monitor integration
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Chaim
Top achievements
Rank 1
Chaim asked on 16 Jul 2014, 01:44 PM
Good day

I've read several threads here, where everyone has been able to use the monitor in a asp.net application... but I can't..., maybe you can help me.

First, I created a .NET Analytics project in the Telerik Platform
Then, on my project I downloaded from nuGet the Telerik Monitor reference
I added the class mentioned below, which I got from the documentation
Then, on my Global.asax I have the code mentioned below, which I got from the same documentation as the class
And finally, just to test, I have a line of code in one of my pages, please see code below

But everytime I try.... nothing happens... the Analytics project never receives data
If I try it, but with JavaScript and a JavaScript Analytics Project, it works... But I don't want Javascript... I want to track some functions that are only on the code behind and also error tracking.

Hope you can help me.

Thanks.

Class:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using EQATEC.Analytics.Monitor;
 
namespace MyApp
{
    public sealed class Analytics
    {
        public IAnalyticsMonitor Monitor { get; private set; }
        private const string s_productId = "651d98a450d74497842b3c5b933f8df9";
        private static readonly Analytics instance = new Analytics();
        static Analytics() { }
        private Analytics()
        {
            var settings = AnalyticsMonitorFactory.CreateSettings(s_productId);
            settings.LoggingInterface = AnalyticsMonitorFactory.CreateTraceMonitor();
            settings.Version = new Version("0.0.2");
            // Modify settings here, if needed. For instance
            // settings.TestMode = true;
            // settings.UseSSL = true;
            Monitor = AnalyticsMonitorFactory.Create(settings);
        }
        public static IAnalyticsMonitor Instance
        {
            get { return instance.Monitor; }
        }
    }
}

Global.asax
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
 
namespace MyApp
{
    public class Global : System.Web.HttpApplication
    {
 
        protected void Application_Start(object sender, EventArgs e)
        {
            Analytics.Instance.Start();
            AppDomain.CurrentDomain.UnhandledException +=
                   (s, ex) => Analytics.Instance.TrackException(ex.ExceptionObject as Exception,
                                                               "AppDomain.UnhandledException");
 
        }
 
        protected void Session_Start(object sender, EventArgs e)
        {
 
        }
 
        protected void Application_BeginRequest(object sender, EventArgs e)
        {
 
        }
 
        protected void Application_AuthenticateRequest(object sender, EventArgs e)
        {
 
        }
 
        protected void Application_Error(object sender, EventArgs e)
        {
 
        }
 
        protected void Session_End(object sender, EventArgs e)
        {
 
        }
 
        protected void Application_End(object sender, EventArgs e)
        {
            Analytics.Instance.Stop();
        }
    }
}

Page.aspx
protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
                Analytics.Instance.TrackFeature("Page.Load");
            }
        }

10 Answers, 1 is accepted

Sort by
0
Thomas.Andersen@telerik.com
Telerik team
answered on 17 Jul 2014, 08:36 AM
Hi Oscar

I think you are using the wrong lifecycle events. Application_start is only called once when the site is started the first time. Application_end is called when IIS pool is recycled. Most likely stop is never called and that's why you don't see any data. To measure sessions on your site you would want to use Session_start and Session_end. Bear in mind that this is not the recommended way to measure your asp.net site. Session_end is not called when the user closes the browser or navigates away. Also the environment metrics send in by the monitor will be on the server and not the client.

Regards,
Thomas.Andersen@telerik.com
Telerik
 
EQATEC Application Analytics is now Telerik Analytics. For more information on the new name, plus what's new in Telerik Analytics, please, check out the Analytics Service Announcement.
 
0
Chaim
Top achievements
Rank 1
answered on 17 Jul 2014, 01:31 PM
Hi Thomas!

Do I need to call stop to send the information back to telerik? I ask this because in Javascript it doesn't matter if I don't call it.. but the session says "running" if I don't call it.
also, I thought Application_Start and End was the way to use it on the server side as Soren and Analytics Team suggest:

http://www.telerik.com/forums/monitor-start-stop-in-asp-net-application-
http://blogs.telerik.com/analytics-team/posts/13-06-26/eqatec-analytics-in-asp.net

Regards
0
Thomas.Andersen@telerik.com
Telerik team
answered on 18 Jul 2014, 07:38 AM
Hi Oscar

I was a little too fast there sorry. Yes you should get usage data and environment data by just calling start. Feature data will, however, not be send in until you call stop, forcesync or trackexceptions. It will also send them in on following start calls. So a couple of follow up questions:

When looking for data are you using the live view or in live mode?
Have you tried implementing the log interface?
The blog post post you linked to is for monitoring the server. Is that what you want?

Regards,
Thomas.Andersen@telerik.com
Telerik
 
EQATEC Application Analytics is now Telerik Analytics. For more information on the new name, plus what's new in Telerik Analytics, please, check out the Analytics Service Announcement.
 
0
Chaim
Top achievements
Rank 1
answered on 18 Jul 2014, 06:14 PM
Hi Thomas!

Let me answer your questions, and maybe with the last one you can help, maybe I'm using something that won't help me or maybe I'm doing it totally wrong

When looking for data are you using the live view or in live mode?
I'm using the "Developer Reports - Live" section (the fourth link from the bottom), the same I use to view the data when I use a Javascript project, but it has been 3 days and nothing appeared, obviously I'm doing something wrong, but I can't figure it out =S (you mentioned the stop, forcesync, trackexceptions, don't really know about those methods)

Have you tried implementing the log interface?
Noup... actually... I don't know about it, didn't read about it on the documentation... where can I learn more about it?

The blog post post you linked to is for monitoring the server. Is that what you want?
Well... I wan't per user, but everything I read is a little discouraging on whether it is possible or not.
Right now I'm just trying to evaluate your product because we ran into a problem.

Our company does "improvements" based on how much they save to the company (money $_$) so one of the initiatives was to migrate our servers to a better hardware and having IIS, SQL Server, AD Server each one in its own server.

But when it came to calculate our savings... we ran into a problem, we couldn't really measure it.
Savings can come as time saved, so we were trying to measure how many seconds will our applications improve once in the new server.

So what we want to achieve is a way to measure how much time does a user spend doing some functions (like exporting to excel, filtering, loading data, etc)

But of course, our authentication is by AD so I can't really call the start and stop in a login form.

We want to keep track of how our applications perform, maybe you can suggest something else =)




0
Richard Flamsholt
Telerik team
answered on 23 Jul 2014, 12:38 PM
Hi Oscar,

Thomas is off on vacation now so I will try to help you out.

First: yes, only Javascript will send tracked data "immediately", while data is bundled and transmitted in larger packets in all other platforms, including .NET. Precisely how this works is described (by me, by the way) in the online documentation. Please check it out.
http://docs.telerik.com/platform/analytics/integration/monitor/introduction
http://docs.telerik.com/platform/analytics/integration/data-lifecycle/introduction

Data is initially sent by just calling Start() so calling Start() should definitely produce some data, regardless of when you call it. We have described as many possible explanations for "where's my data?" as we could think of, so please check that article out: http://docs.telerik.com/platform/analytics/getting-started/your-first-data

The "logger" Thomas mentioned is a mechanism with which the monitor can send back information about progress and problems. Your app already says "settings.LoggingInterface = AnalyticsMonitorFactory.CreateTraceMonitor()" which will install the default logger for .NET, which will print out logging to System.Diagnostics.Debug.WriteLine(). In ASP.NET you will see this if you run your service within Visual Studio or install a debug listener like DebugView from sysinternals (http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx).

Seeing the log output will very often bring you much closer to fixing connectivity problems. You can read more about logging here: http://docs.telerik.com/platform/analytics/integration/functionality/logging

Finally, regarding the actual business issue of tracking performance of you application: if you run the monitor inside you .NET application (server) then it will, of course, only be able to directly track timing etc of operations within the server, not on the webclient. But that would surely still give you useful data. For example, if you have a web method that generates excel-data for some query then you can easily track that call's performance with TrackFeatureStart/Stop on the server, as in the example in the API docs: http://api.eqatec.com/analytics/dotnet/html/M_EQATEC_Analytics_Monitor_IAnalyticsMonitor_TrackFeatureStart.htm

I hope this helps, and your situation (wanting to measure/optimize server performance) is definitely a very good fit for Telerik Analytics.

Regards,
Richard Flamsholt
Telerik
 
EQATEC Application Analytics is now Telerik Analytics. For more information on the new name, plus what's new in Telerik Analytics, please, check out the Analytics Service Announcement.
 
0
Chaim
Top achievements
Rank 1
answered on 23 Jul 2014, 03:24 PM
Hi Richard!

Thank you for your reply!

Now that you told me about the logger... I can see a very big problem... I can't reach your servers...

Start:
EQATEC Analytics Monitor: IAnalyticsMonitor.Start: monitor started
EQATEC Analytics Monitor ***** ERROR *****: Failed to send data to analytics server: Unable to connect to the remote server
EQATEC Analytics Monitor: Statistics failed to be sent: Failed to send data to analytics server: Unable to connect to the remote server


Stop:
EQATEC Analytics Monitor ***** ERROR *****: Failed to send data to analytics server: Unable to connect to the remote server
EQATEC Analytics Monitor: Statistics failed to be sent: Failed to send data to analytics server: Unable to connect to the remote server
EQATEC Analytics Monitor: IAnalyticsMonitor.Stop: monitor stopped

Tried with an open connection and everything went ok, data was received and shown =D
EQATEC Analytics Monitor: IAnalyticsMonitor.Start: monitor started
EQATEC Analytics Monitor: Statistics was sent successfully
EQATEC Analytics Monitor: Statistics was sent successfully
EQATEC Analytics Monitor: IAnalyticsMonitor.Stop: monitor stopped

Could you tell me what is the IP range you use so I can talk about it with our system administrator??, maybe I can get him to open it.
I guess those are different from the Javascript project servers, since there everything went OK from the first time

Thanks!
0
Chaim
Top achievements
Rank 1
answered on 23 Jul 2014, 04:22 PM
I was looking through the documentation (http://docs.telerik.com/platform/analytics/integration/functionality/monitor-settings) and it mentions this URL

http://monitor-eqatec.com/

If I type it in the browser I can succesfully connect and get this message: "Telerik Analytics - data reception"

But still.. the application returns a "Unable to cconnect to the remote server" message

regards!
0
Chaim
Top achievements
Rank 1
answered on 23 Jul 2014, 05:16 PM
ok.. re-reading the documentation it says that I can get the URL from the ServerUri property

so... I did that and the URL seems to be http(s)://KEY.monitor-eqatec.com

If I copy and paste that URL, it returns the message: "Telerik Analytics - data reception"

But the debug output always says that can't connect to the remote server, I also tried with SSL but still no luck

so... what can be the problem??
0
Richard Flamsholt
Telerik team
answered on 24 Jul 2014, 09:11 AM
Hi Oscar,

Okay, now you're getting somewhere. I'm glad you got the logging enabled.

Yes, http://<productid>.monitor-eqatec.com/ (and also just http://monitor-eqatec.com/ for testing) is the data reception endpoint.

So, you can reach it from your browser but the server application cannot reach it. It suggests that the server is being restricted in some manner. Maybe outgoing HTTP-traffic is disallowed in the firewall for the server process' user or executable, while being allowed for you and the web-browser?

Firewall-issues are notoriously hard to debug. A blocking can be indistinguishable from a real problem where the server really cannot be reached. Maybe you can inspect the network traffic using Fiddler or Wireshark, or maybe the firewall has a log that can be enabled and inspected? Maybe there are some hints in this article, too: http://docs.telerik.com/platform/analytics/integration/data-lifecycle/network

Anyway, the problem definitely seems to be that the monitor-component in the server process cannot connect to our server using HTTP to port 80 at monitor-eqatec.com. It may be tricky to find out why, but that's surely the problem. Other that offering the suggestions above, I think you yourself is in the best position to look into why this would be the case and fix it - because surely, it must be possible for the server to allow this; without HTTP access the monitor has little chance of delivering data :-)

Please write me again when you have either identified and solved the problem, or still face the issue.

Regards,
Richard Flamsholt
Telerik
 
EQATEC Application Analytics is now Telerik Analytics. For more information on the new name, plus what's new in Telerik Analytics, please, check out the Analytics Service Announcement.
 
0
Richard Flamsholt
Telerik team
answered on 24 Jul 2014, 09:42 AM
Hi Oscar,

One more thing:

It could also be a proxy issue. You can read about that in http://docs.telerik.com/platform/analytics/integration/data-lifecycle/network

The monitor use the default system proxy settings, if any, so on the same machine the monitor and IE should use the same proxy settings: if IE can access a site then then so should the monitor. But from your post it was not clear to me if you had successfully browsed to monitor-eqatec.com from the same machine as the server was running on, or from some other machine. Please check that you can access monitor-eqatec.com using IE from the server machine.

Regards,
Richard Flamsholt
Telerik
 
EQATEC Application Analytics is now Telerik Analytics. For more information on the new name, plus what's new in Telerik Analytics, please, check out the Analytics Service Announcement.
 
Tags
Monitor integration
Asked by
Chaim
Top achievements
Rank 1
Answers by
Thomas.Andersen@telerik.com
Telerik team
Chaim
Top achievements
Rank 1
Richard Flamsholt
Telerik team
Share this question
or