Skip to content

Commit

Permalink
shift to avoid time alignment ingestion problems
Browse files Browse the repository at this point in the history
  • Loading branch information
rjtokenring committed Sep 17, 2024
1 parent edb6212 commit a1988d3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions business/tsextractor/tsextractor.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ func computeTimeAlignment(resolutionSeconds, timeWindowInMinutes int) (time.Time
resolutionSeconds = 300 // Align to 5 minutes
}
to := time.Now().Truncate(time.Duration(resolutionSeconds) * time.Second).UTC()
if resolutionSeconds <= 900 {
// Shift time window to avoid missing data
to = to.Add(-time.Duration(300) * time.Second)
}
from := to.Add(-time.Duration(timeWindowInMinutes) * time.Minute)
return from, to
}
Expand Down

0 comments on commit a1988d3

Please sign in to comment.