Implement the function of re-generate metrics