Skip to content

Commit 3f145f0

Browse files
committed
remove inf bucket
1 parent eea3832 commit 3f145f0

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

statistics/statistics.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"compress/gzip"
55
"encoding/gob"
66
"fmt"
7-
"math"
87
"net/http"
98
"sort"
109
"strconv"
@@ -43,7 +42,6 @@ func NewWithBuckets(buckets []float64) *Statistics {
4342
name := fmt.Sprintf("%g", value)
4443
s.Buckets = append(s.Buckets, Bucket{name, value})
4544
}
46-
s.Buckets = append(s.Buckets, Bucket{"+Inf", math.MaxFloat64})
4745
return &s
4846
}
4947

@@ -114,6 +112,7 @@ func (s *Statistics) Write(writer *http.ResponseWriter) {
114112
v := ss.Buckets[b.Name]
115113
gw.Write([]byte(metricName + "_total_seconds_bucket{le=" + strconv.Quote(b.Name) + "} " + strconv.FormatUint(v, 10) + "\n"))
116114
}
115+
gw.Write([]byte(metricName + "_total_seconds_bucket{le=+Inf} " + strconv.FormatUint(count, 10) + "\n"))
117116
gw.Write([]byte(metricName + "_total_seconds_sum " + strconv.FormatFloat(sum, 'f', 3, 64) + "\n"))
118117
gw.Write([]byte(metricName + "_total_seconds_count " + strconv.FormatUint(count, 10) + "\n"))
119118
}

0 commit comments

Comments
 (0)