Unable to enable Entlib 2.0 Performance counters

Topics: Caching Application Block , Enterprise Library Core
Jun 21, 2007 at 10:31 AM
Hi,

It should be rather easy, but still it fails. My Enterprise Library Cache is hosted in IIS running on my XP box. I have done as follow:

1. Executed the InstallService.bat
2. Used the Configuration tool to activate setting the Key: PerformanceCountersEnabled = true

From performance I now can add the Performance counters. The problem is that No values are written and all counters are zero. I have debugged the app and I know by certainty that elements are written and read from the cache.

Configurations:


<configSections>
<section name="instrumentationConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.Configuration.InstrumentationConfigurationSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=2.0.0.0, Culture=neutral, PublicKeyToken=f13fad56e27621de" />
</configSections>
<instrumentationConfiguration performanceCountersEnabled="true"
eventLoggingEnabled="false" wmiEnabled="false" />

other:
No Exceptions occures

Any suggestions ?


Regards
Geir


Jun 21, 2007 at 12:44 PM
Hi Geir,

Most of the conters are RateOfCountsPerSecond32 counters, so unless there is continuous activity these counters are usually zero, but you mention that all the counters are zero.
Can you verify that the counter "Total Cache Entries" is zero too?

If no exceptions occur then the permissions should be fine. I'd say you try to repro with a simple console application. Keep in mind that when running on IIS the instance name for the counters will be different for each web app instance.

HTH,
Fernando
Jun 24, 2007 at 10:19 PM
hi,

Total Cache Entries is zero too ? Yes.
A simple console applications works find, I can see movements in many of the EntLib Cache counters. I used the exact same configurations as used in the Web app (I only removed the Web stuff).

I noticed a small but maybe important difference. When no other than the Entlib counters representing the counters of the IIS instance, the "red vertical line " (I do not know the name of it) in PrefMon does not move. As soon as I add any other counter the “red vertical line”, but the counters of the IIS Instance is still zero.

Debugging the IIS app (It’s a Web service application) the Cache Add and GetData methods are called successfully.

If it helps:
IIS: Windows authentication, Impersonate = true, ASPNET user is (for the moment) a member of Administrators

Geir
Jun 25, 2007 at 8:41 PM
Hi Geir,

I could repro this behavior. The perf counter value is not really zero but "---" if you look at the textual representation of the information; this might explain the strange behavior with the "red line".
I'm not sure why this happens, as the values for the perf counters do get updated (a console app could successfully query them).

I'm sorry I cannot give you more information about this issue at this time. If you use other tools to consume the performance counters they it's possible the values will be available.
We'll bring this issue to the attention of the dev team.

Fernando
Jun 26, 2007 at 12:32 PM
Hi Geir,

There seems to be an issue with the instance names generated for IIS, caused by inclusion of characters used to specify a counter path (see http://msdn2.microsoft.com/EN-US/library/aa373193.aspx).

You may want to update the mechanism to build instance names to filter out the offending characters by editing class PerformanceCounterInstanceName until this defect is fixed.

Hope this helps,
Fernando
Sep 27, 2007 at 2:57 AM
Could you guys clarify this issue a bit, because I think I'm experiencing it. What exactly are "offending characters" in an instance name? I'm not sure how EntLib selects an instance name under IIS, but since you mentioned special characters, I think I have periods and underscores in my IIS app name... But I don't see either of those referenced in that MSDN article.

Thanks,

James
Sep 27, 2007 at 4:57 PM
I'll answer my own question here (a bit). A quick and dirty fix for me was to find all EntLib InstrumentationListeners which leveraged the AppDomainNameFormatter in one of their constructors... Then I switched that to use the NoPrefixNameFormatter instead. This makes the counters work in IIS. It has the downside of not differentiating between two instances of the counters running under different IIS apps, but for me this isn't a problem. I'd love to hear about other fixes, especially if they can be done via configuration rather than code.
Sep 28, 2007 at 2:37 PM
Hi James,

Unfortunately, this behavior cannot be changed through configuration. However, if you can modify the code you might as well update the formater (or create a new one) so it creates compliant names; that way you will be able to distinguish the different instances.

Fernando
Sep 28, 2007 at 2:40 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Oct 6, 2007 at 1:39 PM
Hi,

jameskoch wrote:
Could you guys clarify this issue a bit, because I think I'm experiencing it. What exactly are "offending characters" in an instance name? I'm not sure how EntLib selects an instance name under IIS, but since you mentioned special characters, I think I have periods and underscores in my IIS app name... But I don't see either of those referenced in that MSDN article.

Thanks,

James


Quoted from the referenced doc

PDH uses the following special characters in a counter path. Providers should not use these characters in their names. If a provider uses these special characters, PDH cannot parse the full counter path to obtain the counter and instances names.

Character Description
\ Generic separator for computer, object, and counter.
( Beginning of instance name.
) Ending of instance name.
/ Separates instance and parent instance.
#n Identifies a specific occurrence of a same-named instance.
  • Wildcard character.