EntLib 2.0 and performance counters

Topics: Building and extending application blocks
Jun 5, 2007 at 6:26 PM
Hello. I am trying to create and use custom performance counters with the EntLib 2.0. I have the following code in oe of my instrumentation listeners (I'm leaving out the constructors for brevity):

static EnterpriseLibraryPerformanceCounterFactory factory = new EnterpriseLibraryPerformanceCounterFactory();

PerformanceCounter("Authentication Succeeded Events Raised/sec", "AuthenticationSucceededEventRaisedHelpResource", PerformanceCounterType.RateOfCountsPerSecond32)
private EnterpriseLibraryPerformanceCounter authenticationSucceededEventsRaised;

public void AuthenticationSucceededHandler(object sender, AuthenticationExecutionEventArgs e)
if (PerformanceCountersEnabled)

protected override void CreatePerformanceCounters(string[] instanceNames)
authenticationSucceededEventsRaised = factory.CreateCounter(counterCategoryName, "Authentication Succeeded Events Raised/sec", instanceNames);

I have a project installer class and have run InstallUtil over my assembly. When I run the code, my performance counters are not created (CreatePerformanceCounters(string[] instanceNames) is never called) and thus I get an error stating the counter does not exist. How can I get this to work?



Jun 7, 2007 at 10:00 PM
A little help, please?
Aug 23, 2007 at 7:03 AM
Is there a walkthrough in using the Instrumentation block of EntLib or
using performance counters in EntLib??
Can you kindly post the link.

Aug 23, 2007 at 10:01 AM
Just found this site:

Aug 23, 2007 at 2:07 PM

That's a good article. If you run into trouble getting it to work, feel free to hit me up. After fighting and fighting, I got it working.