MattHodge / Graphite-PowerShell-Functions

A group of PowerShell functions that allow you to send Windows Performance counters to a Graphite Server, all configurable from a simple XML file.
https://hodgkins.io/using-powershell-to-send-metrics-graphite
GNU General Public License v3.0
218 stars 71 forks source link

Refactoring #20

Closed ghostsquad closed 9 years ago

ghostsquad commented 9 years ago

I did a bit of refactoring of these functions to

  1. reduce code redundancy
  2. improve performance
  3. fix possible memory leak (IDisposables not within "using" block)
  4. feature add (allowing for SQL & Perf counters to be sent at the same time).

There were quite a few lines with just whitespace, so it looks like a lot more has changed.

MattHodge commented 9 years ago

Thanks for the commit. I will test it out.

ghostsquad commented 9 years ago

I've also replaced write-error with throw. http://stackoverflow.com/questions/9294949/when-should-i-use-write-error-vs-throw

All the areas that you are using write-error at are as a result of a critical issue. Write-Error is only a means to write non-terminating errors.