private ServiceBusPerformanceCounters() { ConsumerThreadCount = new RuntimePerformanceCounter("Consumer Threads", "The current number of threads processing messages.", PerformanceCounterType.NumberOfItems32); ReceiveThreadCount = new RuntimePerformanceCounter("Receive Threads", "The current number of threads receiving messages.", PerformanceCounterType.NumberOfItems32); ReceiveRate = new RuntimePerformanceCounter("Received/s", "The number of messages received per second", PerformanceCounterType.RateOfCountsPerSecond32); PublishRate = new RuntimePerformanceCounter("Published/s", "The number of messages published per second.", PerformanceCounterType.RateOfCountsPerSecond32); SendRate = new RuntimePerformanceCounter("Sent/s", "The number of messages sent per second.", PerformanceCounterType.RateOfCountsPerSecond32); ReceiveCount = new RuntimePerformanceCounter("Messages Received", "The total number of message received.", PerformanceCounterType.NumberOfItems32); PublishCount = new RuntimePerformanceCounter("Messages Published", "The total number of message published.", PerformanceCounterType.NumberOfItems32); SentCount = new RuntimePerformanceCounter("Messages Sent", "The total number of message sent.", PerformanceCounterType.NumberOfItems32); ConsumerDuration = new RuntimePerformanceCounter("Average Consumer Duration", "The average time a consumer spends processing a message.", PerformanceCounterType.AverageCount64); ConsumerDurationBase = new RuntimePerformanceCounter("Average Consumer Duration Base", "The average time a consumer spends processing a message.", PerformanceCounterType.AverageBase); ReceiveDuration = new RuntimePerformanceCounter("Average Receive Duration", "The average time to receive a message.", PerformanceCounterType.AverageCount64); ReceiveDurationBase = new RuntimePerformanceCounter("Average Receive Duration Base", "The average time to receive a message.", PerformanceCounterType.AverageBase); PublishDuration = new RuntimePerformanceCounter("Average Publish Duration", "The average time to Publish a message.", PerformanceCounterType.AverageCount64); PublishDurationBase = new RuntimePerformanceCounter("Average Publish Duration Base", "The average time to Publish a message.", PerformanceCounterType.AverageBase); InitiatizeCategory(); }
ServiceBusPerformanceCounters() { ConsumerThreadCount = new RuntimePerformanceCounter("Consumer Threads", "The current number of threads processing messages.", PerformanceCounterType.NumberOfItems32); ReceiveThreadCount = new RuntimePerformanceCounter("Receive Threads", "The current number of threads receiving messages.", PerformanceCounterType.NumberOfItems32); ReceiveRate = new RuntimePerformanceCounter("Received/s", "The number of messages received per second", PerformanceCounterType.RateOfCountsPerSecond32); PublishRate = new RuntimePerformanceCounter("Published/s", "The number of messages published per second.", PerformanceCounterType.RateOfCountsPerSecond32); SendRate = new RuntimePerformanceCounter("Sent/s", "The number of messages sent per second.", PerformanceCounterType.RateOfCountsPerSecond32); ReceiveCount = new RuntimePerformanceCounter("Messages Received", "The total number of message received.", PerformanceCounterType.NumberOfItems32); PublishCount = new RuntimePerformanceCounter("Messages Published", "The total number of message published.", PerformanceCounterType.NumberOfItems32); SentCount = new RuntimePerformanceCounter("Messages Sent", "The total number of message sent.", PerformanceCounterType.NumberOfItems32); ConsumerDuration = new RuntimePerformanceCounter("Average Consumer Duration", "The average time a consumer spends processing a message.", PerformanceCounterType.AverageCount64); ConsumerDurationBase = new RuntimePerformanceCounter("Average Consumer Duration Base", "The average time a consumer spends processing a message.", PerformanceCounterType.AverageBase); ReceiveDuration = new RuntimePerformanceCounter("Average Receive Duration", "The average time to receive a message.", PerformanceCounterType.AverageCount64); ReceiveDurationBase = new RuntimePerformanceCounter("Average Receive Duration Base", "The average time to receive a message.", PerformanceCounterType.AverageBase); PublishDuration = new RuntimePerformanceCounter("Average Publish Duration", "The average time to Publish a message.", PerformanceCounterType.AverageCount64); PublishDurationBase = new RuntimePerformanceCounter("Average Publish Duration Base", "The average time to Publish a message.", PerformanceCounterType.AverageBase); InitiatizeCategory(); }
IPerformanceCounter CreateCounter(RuntimePerformanceCounter counter) { try { return(new InstancePerformanceCounter(counter.Name, ServiceBusPerformanceCounters.CategoryName, InstanceName)); } catch (InvalidOperationException ex) { _log.Warn("Unable to create performance counter", ex); return(new NullPerformanceCounter()); } }
IPerformanceCounter CreateCounter(RuntimePerformanceCounter counter) { try { return new InstancePerformanceCounter(counter.Name, ServiceBusPerformanceCounters.CategoryName, InstanceName); } catch (InvalidOperationException ex) { _log.Warn("Unable to create performance counter", ex); return new NullPerformanceCounter(); } }