I spotted that NLog have a Windows Performance Counter target and decided to give it a whirl.
I’m currently working heavily with windows performance counters using a framework called PerfIt! and wanted to see if there was an easier to configure solution.
Grab the source code here: https://github.com/3686/Alexw.NLogPerformanceCountersExample
Using the topshelf getting started guide I created a quick example app which would write an INFO level log every second.
The real magic happens in the target file. This is where the counters are created using the
When you put this all together, you get automatically created Performance Counters (available after you’ve restarted your console of course).