Consolidate the duplicated get_metric_values functions.