[filter/metrics] Fix flushing in metrics filter

As discovered in #1805, metrics filter is not correctly flushing events

The current spec was calling flush manually not relying on the pipeline periodic_flusher threads, 
here is a proposal test case using the full agent to cover this case + fix to metrics filter based on the changed done to other flushing filters (multiline, spool) in #1545 
Writing to a file is probably not the simplest way to do test this. If there's something missing from the test suite to make this easier and just specify the filter, we should make it better