mirror of
https://github.com/hanzoai/traces.git
synced 2026-10-30 18:20:41 +00:00
* rhythm: set ingestion slack for partition consumption * remove test * Update WalBlock interface to explicitly compute the ingestionSlack * add cycle duration to slack ingestion range calculation * distinguish between ingesters and blockbuilder for dataquality warnings
30 lines
583 B
Go
30 lines
583 B
Go
package common
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/grafana/tempo/pkg/dataquality"
|
|
)
|
|
|
|
func AdjustTimeRangeForSlack(tenantID string, ingestionSlack time.Duration, start, end uint32) (uint32, uint32) {
|
|
now := time.Now()
|
|
startOfRange := uint32(now.Add(-ingestionSlack).Unix())
|
|
endOfRange := uint32(now.Add(ingestionSlack).Unix())
|
|
|
|
warn := false
|
|
if start < startOfRange {
|
|
warn = true
|
|
start = uint32(now.Unix())
|
|
}
|
|
if end > endOfRange || end < start {
|
|
warn = true
|
|
end = uint32(now.Unix())
|
|
}
|
|
|
|
if warn {
|
|
dataquality.WarnOutsideIngestionSlack(tenantID)
|
|
}
|
|
|
|
return start, end
|
|
}
|