Share via


Instrumenting the Validation Application Block

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The latest Enterprise Library information can be found at the Enterprise Library site.

These are the sections in the application's configuration file for enabling or disabling instrumentation. They are optional, but you must either have both or neither in the file. If you omit them, it is the same as if all the values are false. The <configSections> section is where you tell the System.Configuration library how to read the actual configuration data. The actual data is in the <instrumentationConfiguration> section. Setting a value to true enables the instrumentation. Setting a value to false disables the instrumentation. The three types of instrumentation are performance counters, event logging, and WMI events.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
      <configSections>
         <section name="instrumentationConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.Configuration.InstrumentationConfigurationSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=3.1.0.0, Culture=neutral, PublicKeyToken=null" />
      </configSections>
  <instrumentationConfiguration performanceCountersEnabled="true" eventLoggingEnabled="true" wmiEnabled="true" />
</configuration>

Validation Application Block Performance Counters

The following table lists the Validation Application Block performance counters.

Table 1: Validation Application Block Performance Counters

Performance Counter

Counter Type

Number of Validation Calls

NumberOfItems32

Number of Validation Successes

NumberOfItems32

Number of Validation Failures

NumberOfItems32

Validation Calls/sec

RateOfCountsPerSecond32

Validation Successes/sec

RateOfCountsPerSecond32

Validation Failures/sec

RateOfCountsPerSecond32

% Validation Successes

RawFraction

Validation Successes Base

RawBase

These performance counters are in the Enterprise Library Validation Counters category. Each performance counter has two instances. They are:

  • AppDomain – Total, where total is all of the types that are validated within the AppDomain.

  • AppDomain – TypeName, where (TypeName) is the name of the type being validated.

    For more information about performance counters, see PerformanceCounterType Enumeration in the .NET Framework Class Library on MSDN.

Validation Application Block Event Log Entries

The Validation Application Block is instrumented to log entries to the application event log if a validation fails. The failure is attributed to "Enterprise Library Validation" and it is described as an "Error."

Validation Application Block WMI Events

The Validation Application Block is instrumented with WMI events. They are listed in the following table.

Table 2: WMI Events

WMI event class name

Description

ValidationSucceededEvent

The event occurs every time a successful validation occurs. The event contains the full name of the type that was validated.

ValidationFailedEvent

This event occurs every time a validation fails. The event contains the full name of the type that was validated.

ValidationExceptionEvent

This event occurs every time an unhandled exception occurs during a validation. The event contains the full name of the type that was validated and the exception message.

ValidationConfigurationFailureEvent

This event occurs every time a validation is invoked but the configuration is invalid. The event contains the exception message.

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The latest Enterprise Library information can be found at the Enterprise Library site.