Metrics Batching| Add tests for automatic flush of the buffer