How to: Configure Telerik® Data Access Project For Real-Time Monitoring

This article is relevant to entity models that utilize the deprecated Visual Studio integration of Telerik Data Access. The current documentation of the Data Access framework is available here.

The Telerik Data Access Profiler offers you a real-time (live) monitoring via a Telerik Data Access implemented web service. This topic demonstrates you how to configure a Telerik Data Access application for a real-time monitoring.

Preparing an Application to be Profiled

To prepare your application for a real-time (live) monitoring:

  1. First, you need to add a reference to the Telerik.OpenAccess.ServiceHost.dll assembly.

  2. The next step is to set few options in the Model Settings Dialog. Right-click on an empty area in the Visual Designer and select Show Model Settings.

  3. This will open the Model Settings Dialog. Go to the Backend Configuration -> Tracing and Logging settings. The Tracing and Logging settings allow you to configure the event logging properties, such as specifying the log file name, controlling the amount of logging information to be generated, etc.
  4. The snapshot below shows you the minimal settings you need to consider and/or specify:

  5. Ensure that the Enable Logging option is set to True.

  6. The first step is to specify the amount of logging information to be generated. This is controlled by the Log Level setting. The event logging levels are as follows:
    1. None - logs no events.
    2. Errors - logs only serious errors (such as connections timing out). This is the default value.
    3. Normal - logs the most useful events that do not reduce performance significantly (e.g. SQL executed).
    4. Verbose - logs lots of events (this slows down the performance, could be used while debugging).
    5. All - logs all possible events (this slows down the performance very significantly, could be used while debugging).
  7. The Include Stack Trace setting controls if the logging facilities append stack trace information. The default value for this option is False. In this demo it is set to True.
  8. Telerik Data Access produces two different kinds of data - metrics and events. Metrics are similar to the operating system counters. They produce snapshots of the system status like counting insert, update and delete statements per second. Log events contain the real operation information, including query parameters and stack traces. Compared to metrics, the production of log events is far more expensive and can slow down the application. Set the following options to True:
    1. Keep Events for Profiler - allows the user to configure the events store.
    2. Keep Metrics for Profiler - allows the user to configure the metrics store.
  9. The final step is to define the size of the event/metric store in the memory. This is controlled by the Events Threshold and Metrics Threshold settings.
  10. Next, you need to start the web service host from the application:

    Telerik.OpenAccess.ServiceHost.ServiceHostManager.StartProfilerService(15555);
    
    Telerik.OpenAccess.ServiceHost.ServiceHostManager.StartProfilerService(15555)
    

    Where the parameter contains the communication port number. Later in the profiler, the server name, the database name and this port are necessary to initiate the online download. 15555 is the default communication port number. That is the port number that the Profiler expects (by default). But you could change it to whatever you want. Just make sure you are setting the same number in the Connection dialog of the Profiler.

    You could optionally shut down the service, it is not mandatory. You need to call the StopProfilerService method.

    Telerik.OpenAccess.ServiceHost.ServiceHostManager.StopProfilerService();
    
    Telerik.OpenAccess.ServiceHost.ServiceHostManager.StopProfilerService()
    

    In web applications, the best places to start and stop the service are in the Application_Start and Application_End event handlers in the Global.asax.cs class.

Setting the Profiler Port Number

The port information could also be added to the app/web.config file. Then you need to pass the key of the appSettings node to the StartProfilerService method. If no port is found, then the server is not started. The advantage of this approach is that you can configure your application without recompilation. You just need to edit the configuration file.

<configuration>
 <appSettings>
   <add key="ProfilerPort" value ="15555"/>
 </appSettings>
</configuration>

Telerik.OpenAccess.ServiceHost.ServiceHostManager.StartProfilerService("ProfilerPort");
Telerik.OpenAccess.ServiceHost.ServiceHostManager.StartProfilerService("ProfilerPort")

Online Monitoring with the Telerik Data Access Profiler

In order to start a real-time monitoring in the Telerik Data Access Profiler, you need to use the Connect To Toolbar Command.

This will open the Open Connection dialog. Here you need to enter the connection string name (from the app/web config file) and the server name you are using in your application, as well as the port number you have passed to the web service.