次の方法で共有


Ajax Instrumentation

1 Introduction

.NET supports lot of API’s for doing instrumentation with help of trace, TraceSource classes etc, but there is nothing on the client side front in web apps to do the instrumentation. With so many applications been build using Ajax there is no way to instrument the java script code. In fact ASP.Net Ajax framework also has nothing to support this out of the box. This gives the approach to instrument the client side java script code

Note: This is currently in development phase. Will upload the code when it is fully developed and tested

2 Overview

Ajax instrumentation framework gives the option to instrument the client side java script code. This framework comprises of ASP.Net script controls and client-script libraries. Client side java script code invokes the Ajax instrumentation java script API’s to instrument the code.

3 Technologies

1.  .Net 2.0

2. Asp .Net Ajax Framework.

3. IIS.

4 Proposed Solution

 

Figure 3‑1: Ajax Instrumentation

Ajax instrumentation can be categorized in to following components

1. Server Side Components

2. Client Side Components

3. Ajax Web Service / WCF Service

4.1 Server Side Components

This would be typically an ASP.Net 2.0 Web app using Ajax Instrumentation. Block diagram is been shown below

Figure 3 2 : Server Side Components for Web Apps.

4.1.1 Trace Manager

It is script control which adds the Ajax trace listeners as per the config file. There would be separate config file for Ajax instrumentation. Please see the configuration section for details.

4.1.2 Ajax Trace Listener

Ajax trace listener is a component which when added to the trace manager listener collection will emit the java script so as to add the listener at client side. It is been inherited from Base Listener class.

4.1.3 Web Page Base

All the web apps that need to use the Ajax instrumentation need to inherit their web page from Web Page Base class. This class basically overrides the pre-render and Init events to inject the trace manager script control which in turn will injects the trace listener. Trace manager script control has overridden pre-render method, which basically gets the list of the listeners added to trace manager; each listener has Create Script property which returns the script for registering the listener at client side. Trace managers just iterates through all the listeners in the collection gets the script associated with it and registers it using the script manager.

4.2 Client Side Components

This can also be stated as Client Side asynchronous communication layer.

 

 

Figure 3‑3: Client Side Components (Asynchronous Communication Layer)

4.2.1 Client Side Java Script Code

This comprises of the java script code associated with web app. For invoking the Ajax instrumentation API’s, java script code associated with it needs to be injected. This needs to be done manually by the developer. Developer will adding java script code for the API’s and will be passing appropriate parameters to it.

4.2.2 Ajax Instrumentation Java script API’s

Java script code which invokes the Ajax instrumentation API’s

4.2.3 Ajax Trace Manager

This is a client side java script class. The entire set of java script API’s that need to be invoked to do java script diagnostics will be in this class. This class will also be holding the listeners collections, which will be initialized by the scripts generated by the trace manager control. The trace manager control will be injected in to the page by Web page base class. When the trace manager Ajax instrumentation API is been invoked internally it iterates through all the listener collection and calls the respective API’s of that Ajax listener class.

4.2.4 Ajax Trace Listener

This is again a java script class. API’s of this class will be only be invoked if the listener is been added in the trace manager using configuration. API’s of this class will invoke the Ajax trace web service / WCF service and pass the trace data to it. This class will be basically queuing up all the tracing requests, will be passing all the queued data after configured time interval. Web Service will be invoked by the trace listener class after specific interval.

4.3 Ajax Web Service / WCF Service

This also can be categorized as server side component for Asynchronous communication layer.

 


Figure 3‑4: Server Side Asynchronous Communication Layer

This service will be invoked by the java script Ajax instrumentation API’s. This service then passes the trace data that it has received to the Sym Instrumentation.