mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[DataForge] Align events to the nearist interval (#211951)
## Summary This PR changes the behavior of `indexing.alignEventsToInterval: true` (`--align-events-to-interval`) to align the events to the nearest interval instead of being based on when the command was called. This change is to help increase the predictability of the documents. This will also decrease the effects of the index latency on the events. ### Before If the script was started at `2025-02-20T00:50:34.203Z` with `--interval 10000` then the events will be offset every `10` seconds from the start time. ### After If the script was started at `2025-02-20T00:50:34.203Z` with `--interval 10000` then the events will be offset from `2025-02-20T00:50:00.000Z` every `10` seconds from the start time. Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
681cef4590
commit
57f83bc201
1 changed files with 3 additions and 1 deletions
|
@ -36,7 +36,9 @@ export async function indexSchedule(config: Config, client: Client, logger: Tool
|
|||
const compiledSchedule = config.schedule.map(parseSchedule(now));
|
||||
for (const schedule of compiledSchedule) {
|
||||
const interval = schedule.interval ?? config.indexing.interval;
|
||||
const startTs = moment(schedule.start);
|
||||
const startTs = config.indexing.alignEventsToInterval
|
||||
? moment(schedule.start).startOf('minute')
|
||||
: moment(schedule.start);
|
||||
const end =
|
||||
schedule.end === false && startTs.isAfter(now)
|
||||
? moment(schedule.start + interval)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue