User defined sorting for metric groups

Added the capability for users to define custom ordering of elements in metric groups. If the function sort_metric_group_metrics exists it will be called in the construction of metric groups. The function takes two arguments: group-name, and an array of metric names. The return value of the function is the array of metric names in the user-specified order.