Precision fermentation with mass spectrometry-based spent media analysis