NimbusAPI / Nimbus

Nimbus is a .NET client library to provide an easy abstraction over common messaging frameworks.
http://nimbusapi.com/
MIT License
112 stars 84 forks source link

HeartBeat messages #265

Closed stevehayles closed 4 years ago

stevehayles commented 7 years ago

Really cool project !

Just trying to make better use of the heartbeat messages to monitor my application running a number of Azure services.

I think it's a small 'bug' that in reality makes no difference to the end result but I think that the classes TotalCpuUsage and PerProcessCpuUsage in Nimbus.Infrastructure.Heartbeat.PerformanceCounters.System are actually backwards with the PerProcessCpuUsage reading the "_Total" instance name.

A bigger issue in my mind is that configuring the counter with PerformanceCounter("Process", "% Processor Time", "_Total") will return a percentage value that includes the system idle process and will very often sit around 99 or 100 which makes it fairly irrelevant

Changing this to PerformanceCounter("Processor", "% Processor Time", "_Total") (very subtle change!) will return a more meaningful CPU reading.

In working through this problem, I now also get the feeling that changing some Internal interfaces to Public would be beneficial in allowing a very simple way of changing the implementation especially when using a third party IOC container.

I am thinking specifically of 'IHeartbeat' in this case

DamianMac commented 7 years ago

Thanks @stevehayles I'll take a look. Doing some pluggable heartbeat implementation is on the cards too, somebody suggested a .WithHeartbeat extension which isn't a bad idea.