Description
As part of https://jira.camunda.com/browse/OPT-3686, we added the use of existing external event traces to determine the type of a gateway. We have a max sample size when we load this, but otherwise just match all traces.
We should restrict this search to only completed sequences. In the context of external event sources, this is traces that contain at least one start events (an event exists in a sequence count as source event but not in any sequence counts as target event) or end events (vice versa). We should also look at random scoring to avoid the skewing of traces being used.
ATs:
- We limit the external event trace to only consider completed external event traces
- We score randomly to get a proper sample of traces