Compile regex pattern for MetricFilter only once #2637
Noticed a static regex getting compiled 60 times per second on my system. Modified implementation so that it gets compiled only once. Also moved the anonymous class outside run() so that further tests are easier to implement.
Motivation and Context
This tiny change frees whopping ~1 millisecond of CPU time every second for actual message processing duties.
How Has This Been Tested?
Added a unit test for positive test case.
Screenshots (if appropriate):
Types of changes