Equal compares first the metrics, then the timestamp, then the value. The semantics of value equality is defined by SampleValue.Equal.
(o *Sample)
| 41 | // Equal compares first the metrics, then the timestamp, then the value. The |
| 42 | // semantics of value equality is defined by SampleValue.Equal. |
| 43 | func (s *Sample) Equal(o *Sample) bool { |
| 44 | if s == o { |
| 45 | return true |
| 46 | } |
| 47 | |
| 48 | if !s.Metric.Equal(o.Metric) { |
| 49 | return false |
| 50 | } |
| 51 | if !s.Timestamp.Equal(o.Timestamp) { |
| 52 | return false |
| 53 | } |
| 54 | if s.Histogram != nil { |
| 55 | return s.Histogram.Equal(o.Histogram) |
| 56 | } |
| 57 | return s.Value.Equal(o.Value) |
| 58 | } |
| 59 | |
| 60 | func (s Sample) String() string { |
| 61 | if s.Histogram != nil { |