Less compares first the metrics, then the timestamp.
(i, j int)
| 141 | |
| 142 | // Less compares first the metrics, then the timestamp. |
| 143 | func (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 | |
| 156 | func (s Samples) Swap(i, j int) { |
| 157 | s[i], s[j] = s[j], s[i] |