Fix metrics service component and various related test helpers.