mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Include interval test.
This commit is contained in:
parent
758a3f0764
commit
4e73c4c204
|
@ -102,6 +102,24 @@ func (v Values) Swap(i, j int) {
|
||||||
v[i], v[j] = v[j], v[i]
|
v[i], v[j] = v[j], v[i]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// InsideInterval indicates whether a given range of sorted values could contain
|
||||||
|
// a value for a given time.
|
||||||
|
func (v Values) InsideInterval(t time.Time) (s bool) {
|
||||||
|
if v.Len() == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if t.Before(v[0]).Timestamp {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if !v[v.Len()-1].Timestamp.Before(t) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
type SampleSet struct {
|
type SampleSet struct {
|
||||||
Metric Metric
|
Metric Metric
|
||||||
Values Values
|
Values Values
|
||||||
|
|
Loading…
Reference in a new issue