fix(bug): sort list before calculating percentile
fix(bug): emit metric type as GAUGE for average percentile
add(test): spec for percentile