Reputation: 5474
I am trying to connect directly to the performance counters emitted by ServiceModel (for services, endpoints and operations). The problem is that when I try to correlate with a certain service (or endpoint/operation) I need to specified instance name of the counter.
According to MSDN the pattern by which instance name is simple, however in certain cases when one of the components of the instance name (uri, contract name, etc.) is too long it’s shortened and hash code is added at either the beginning or the end of the string.The article doesn’t specify how it’s hashed.
So my question is there a way to get ServiceModel instance name based on the service name and it's address
Upvotes: 1
Views: 313
Reputation: 11440
I know it is not ideal, but you could copy the current .NET implementation for generating counter instance names to your own code/application to programatically generate the same names from the full service name and address.
You can see the code used by WCF here:
For SerivcePerformanceCounters:
For EndpointPerformanceCounters:
For OperationPerformanceCounters:
The downside is that any change to the .NET algorithm for naming instances will break your implementation.
I'm as frustrated as you surely are, but haven't found a better solution.
Upvotes: 2