type LabelPairSorter … func (s LabelPairSorter) Len() int { … } func (s LabelPairSorter) Swap(i, j int) { … } func (s LabelPairSorter) Less(i, j int) bool { … } type MetricSorter … func (s MetricSorter) Len() int { … } func (s MetricSorter) Swap(i, j int) { … } func (s MetricSorter) Less(i, j int) bool { … } // NormalizeMetricFamilies returns a MetricFamily slice with empty // MetricFamilies pruned and the remaining MetricFamilies sorted by name within // the slice, with the contained Metrics sorted within each MetricFamily. func NormalizeMetricFamilies(metricFamiliesByName map[string]*dto.MetricFamily) []*dto.MetricFamily { … }