Skip to content

Commit 5fb241f

Browse files
committed
WritePrometheus: reduce metricType() calls.
1 parent 553adcc commit 5fb241f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

set.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,12 @@ func (s *Set) WritePrometheus(w io.Writer) {
4747
return fName1 < fName2
4848
}
4949

50+
mType1 := s.a[i].metric.metricType()
51+
mType2 := s.a[j].metric.metricType()
52+
5053
// stabilize the order for summary and quantiles.
51-
if s.a[i].metric.metricType() != s.a[j].metric.metricType() {
52-
return s.a[i].metric.metricType() < s.a[j].metric.metricType()
54+
if mType1 != mType2 {
55+
return mType1 < mType2
5356
}
5457

5558
// lastly by metric names, which is for quantiles and histogram buckets.

0 commit comments

Comments
 (0)