Resource 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

Once Instrumentation has been added to your configuration you can switch on the various features from the property window
Performance Counters
The following tables describes the Resource Application Block performance counters:
Performance Counter | Description |
Total Resource Entries | The total number of resources in a set |
Total Resource Accesses | The total number of resources accessed |
Resource Access Rate | The rate per second of resource accesses |
If you have switched on Performance Counters through the Configuration Console then you can use
Performance Monitor to track Resource 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 Resource Application Block. This is required so that performance monitor can attach itself to your resource manager instances.
When you load performance monitor, first remove the default counters and then add the Resource Application Block counters that you need. Select the computer that is running your application, select
Enterprise Library Resource 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 resource manager instances that you have currently loaded.

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 resources in the current set, the total number of resources that your application has accessed since starting the monitor and the rate of access per second.
Event Log Entries
If event logging is switched on then all Resource Application Block failures are logged to the Windows NT
Application Event Log, the event log source name is
Enterprise Library Resource and the entry is described as an
Error. Logged events include the following:
Listener | Event | Exception | Main Message | Additional |
ResourceInstrumentationListener | ResourceFailed | true | The error occurred using the instance name instance. | Any general exception |
DefaultResourceEventLogger | ResourceConfigurationFailure | true | The error occurred retrieving the configuration for instance instance name. | Errors from the Configuration Console |
DefaultResourceEventLogger | ResourceFailure | true | The error occurred using the instance name instance. | Alternative general exception handler |
WMI Events
With WMI Events switched on then the Resource Application Block is instrumented with the following Windows Management Instrumentation (WMI) events:
- ResourceFailureEvent
- ResourceConfigurationFailureEvent
All WMI events are registered under the namespace of
root\EnterpriseLibraryThe following tables describe each WMI event's properties.
Table 1: ResourceFailureEvent PropertiesWMI Property | Description |
ErrorMessage | The error message that describes the failed resource activity. |
ExceptionMessage | The message for the exception that was raised when the resource activity failed. |
InstanceName | The ID of the resource manager that suffered the failure, as specified in the configuration file. |
UtcTimeStamp | The time that the resource activity failed. |
Table 2: ResourceConfigurationFailureEvent PropertiesWMI Property | Description |
ExceptionMessage | The message for the exception that was raised when the attempt to create or configure a resource manager failed. |
InstanceName | The ID of the resource manager 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:

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