elastic / elastic-integration-corpus-generator-tool

Command line tool used for generating events corpus dynamically given a specific integration
Other
21 stars 12 forks source link

Refactor date period last event now #116

Closed aspacca closed 9 months ago

aspacca commented 9 months ago

We want to be able to set a period for the date field where, instead having the first generated event on now, we will have the last one on now (imagine the case when used with the timestamp of an event).

Since period already accepts a negative duration, we achieve this with that: setting a negative duration will results in having the last event generated on now (the case of a negative duration was ignored before, and fall back to no period set at all).

There's also another refactoring related to the case of a date field: before each events was generated in span of an hour before now, randomly, with events not in chronological order. This could have required to sort the events afterward. Now we generated every date field from the date of the previous event (now, for the first event) and a random amount of milliseconds between 0 and 1000

aspacca commented 9 months ago

@tommyers-elastic . all good here? can we merge?

aspacca commented 9 months ago

As soon as we have this PR in, it will help to have at least one benchmark available that uses a negative period as an example on how to use it.

https://github.com/elastic/integrations/pull/8443/commits/99351cfa2ae75e8ec353492d965f2bee491ff18b and https://github.com/elastic/integrations/pull/8444/commits/3f2008ebf99277e0e8ce659c54a361c07f0ac26c