Query Application Block Instrumentation

The Enterprise Library plugs into three different instrumentation features: Performance Counters for performance monitoring, Event Logging for failure logging mainly and WMI Events again for tracking failures.

Instrumentation is configured through the Configuration Console

Adding Instrumentation

Once Instrumentation has been added to your configuration you can switch on the various features from the property window

Turning on Performance Counters

Performance Counters

The following tables describes the Query Application Block performance counters:

Performance Counter Description
Total Query Read Count The total number of records read
Custom Query Read Count The total number of custom records read
Data Query Read Count The total number of data records read
File Query Read Count The total number of file records read
Service Query Read Count The total number of service records read
Total Query Reads The total number of read operations
Custom Query Reads The total number of custom read operations
Data Query Reads The total number of data read operations
File Query Reads The total number of file read operations
Service Query Reads The total number of service read operations
Total Query Writes The total number of write operations
Custom Query Writes The total number of custom write operations
Data Query Writes The total number of data write operations
File Query Writes The total number of file write operations
Service Query Writes The total number of service write operations
Query Read Count Rate The rate of records read per second
Custom Query Read Count Rate The rate of custom records read per second
Data Query Read Count Rate The rate of data records read per second
File Query Read Count Rate The rate of file records read per second
Service Query Read Count Rate The rate of service records read per second
Query Read Rate The rate of reads per second
Custom Query Read Rate The rate of custom reads per second
Data Query Read Rate The rate of data reads per second
File Query Read Rate The rate of file reads per second
Service Query Read Rate The rate of service reads per second
Query Write Rate The rate of writes per second
Custom Query Write Rate The rate of custom writes per second
Data Query Write Rate The rate of data writes per second
File Query Write Rate The rate of file writes per second
Service Query Write Rate The rate of service writes per second


If you have switched on Performance Counters through the Configuration Console then you can use Performance Monitor to track Query Application Block usage by selecting the Performance administrative tool from the start menu.

Before you use the performance monitor you will need to load your application that uses the Query Application Block. This is required so that performance monitor can attach itself to your query instances.

When you load performance monitor, first remove the default counters and then add the Query Application Block counters that you need. Select the computer that is running your application, select Enterprise Library Query Counters from the performance object combo box and select any of the above listed performance counters from the counters list. Note: the instances list will show you all the query instances that you have currently loaded.

Adding Query Application Block Performance Counters

As you use your application you will see the performance monitor display the values of your counters graphically, showing things like the total number of data reads, the total number of records that your application has accessed from a relational database since starting the monitor, total number of file reads and the total number of records read from files as in this example below.

Monitoring Performance

Event Log Entries

If event logging is switched on then all Query Application Block failures are logged to the Windows NT Application Event Log, the event log source name is Enterprise Library Query and the entry is described as an Error. Logged events include the following:

Listener Event Exception Main Message Additional
QueryInstrumentationListener QueryFailed true The error occurred using the instance name instance. Any general exception
DefaultQueryEventLogger QueryConfigurationFailure true The error occurred retrieving the configuration for instance instance name. Errors from the Configuration Console
DefaultQueryEventLogger QueryFailure true The error occurred using the instance name instance. Alternative general exception handler


Query Application Block Event Log Entries

WMI Events

With WMI Events switched on then the Query Application Block is instrumented with the following Windows Management Instrumentation (WMI) events:
  • QueryFailureEvent
  • QueryConfigurationFailureEvent
All WMI events are registered under the namespace of root\EnterpriseLibrary
The following tables describe each WMI event's properties.

Table 1: QueryFailureEvent Properties
WMI Property Description
ErrorMessage The error message that describes the failed query activity.
ExceptionMessage The message for the exception that was raised when the query activity failed.
InstanceName The ID of the query that suffered the failure, as specified in the configuration file.
UtcTimeStamp The time that the query activity failed.


Table 2: QueryConfigurationFailureEvent Properties
WMI Property Description
ExceptionMessage The message for the exception that was raised when the attempt to create or configure a query failed.
InstanceName The ID of the query that could not be created or configured, as specified in the configuration file.
UtcTimeStamp The time that the configuration failure occurred.


A good tool to use is the WMI CIM Studio tool available as a free download:

WMI CIM Studio

For more information see the documentation that comes with the Enterprise Library 4.1

Last edited Dec 21, 2009 at 12:39 PM by ewdev, version 4

Comments

No comments yet.