Adds tests for metrics filter and fixes key collision

When using multiple instances of the metrics filter,
the keys collided, making the counters interfere with
each other.