Implement "algorithm side" of custom metrics