MCPcopy Create free account
hub / github.com/prometheus/common / Less

Method Less

model/value.go:143–154  ·  view source on GitHub ↗

Less compares first the metrics, then the timestamp.

(i, j int)

Source from the content-addressed store, hash-verified

141
142// Less compares first the metrics, then the timestamp.
143func (s Samples) Less(i, j int) bool {
144 switch {
145 case s[i].Metric.Before(s[j].Metric):
146 return true
147 case s[j].Metric.Before(s[i].Metric):
148 return false
149 case s[i].Timestamp.Before(s[j].Timestamp):
150 return true
151 default:
152 return false
153 }
154}
155
156func (s Samples) Swap(i, j int) {
157 s[i], s[j] = s[j], s[i]

Callers

nothing calls this directly

Calls 1

BeforeMethod · 0.45

Tested by

no test coverage detected