mirror of
https://github.com/prometheus/prometheus.git
synced 2025-02-02 08:31:11 -08:00
Add Head.AppendableMinValidTime() (#9643)
Signed-off-by: Marco Pracucci <marco@pracucci.com>
This commit is contained in:
parent
b40e254f25
commit
edd05d7010
|
@ -141,6 +141,16 @@ func (h *Head) appendableMinValidTime() int64 {
|
|||
return max(h.minValidTime.Load(), h.MaxTime()-h.chunkRange.Load()/2)
|
||||
}
|
||||
|
||||
// AppendableMinValidTime returns the minimum valid time for samples to be appended to the Head.
|
||||
// Returns false if Head hasn't been initialized yet and the minimum time isn't known yet.
|
||||
func (h *Head) AppendableMinValidTime() (int64, bool) {
|
||||
if h.MinTime() == math.MaxInt64 {
|
||||
return 0, false
|
||||
}
|
||||
|
||||
return h.appendableMinValidTime(), true
|
||||
}
|
||||
|
||||
func max(a, b int64) int64 {
|
||||
if a > b {
|
||||
return a
|
||||
|
|
Loading…
Reference in a new issue