A general purpose, customizable, event generator.
Please refer to event-source
function doc string for more
details.
A general purpose, customizable, event generator. Please refer to `event-source` function doc string for more details.
(chance p)
(default-fill->viewable-wait)
(default-fill->viewable-wait x)
This function is meant to work as an example and as a good
default to compute the transition time from fill to impression.
We are assuming that 85% of the time there will be a transition in the range of 100 to 2000 milliseconds (expressed as a linear interpolation between min and max) and, for the remaining cases, we expect a maximum time of 15 minutes (900000 milliseconds) and the growth to be exponential. We created the formulas using this nice little tool: https://mycurvefit.com/
This function is meant to work as an example and as a `good` default to compute the transition time from fill to impression. We are assuming that 85% of the time there will be a transition in the range of 100 to 2000 milliseconds (expressed as a linear interpolation between min and max) and, for the remaining cases, we expect a maximum time of 15 minutes (900000 milliseconds) and the growth to be exponential. We created the formulas using this nice little tool: https://mycurvefit.com/
(event-source {:keys [flow-id-fn event-spec]
:or {flow-id-fn (fn [] (uuid-str))
event-spec default-event-spec}})
Returns a generator (fn []) that returns events of form [<flow-id> <event-id>]. Simulates a "real" event source like a set of users that are generating events:
event-spec
of form:
[[<event-id-1> <probability-to-transition-to-event-id-2> <wait-spec>]
[<event-id-2> <probability-to-transition-to-event-id-3> <wait-spec>]
...
[<event-id-N> 0]] to define the logical ordered sequence/flow, the
probability of transitioning between events, and the time to wait before
transitioning.
wait-spec
can be of the form:<const-msecs>
Returns a generator (fn []) that returns events of form [<flow-id> <event-id>]. Simulates a "real" event source like a set of users that are generating events: - Over time - Where each event is part of a logical ordered sequence/flow - Where the logical flow can be terminated at any time i.e. each flow is a subset [ev_1 ... ev_n] of [ev_1 ... ev_N], n <= N with events occuring over time. Takes an `event-spec` of form: [[<event-id-1> <probability-to-transition-to-event-id-2> <wait-spec>] [<event-id-2> <probability-to-transition-to-event-id-3> <wait-spec>] ... [<event-id-N> 0]] to define the logical ordered sequence/flow, the probability of transitioning between events, and the time to wait before transitioning. `wait-spec` can be of the form: - <const-msecs> - [<min-msecs> <max-msecs>] - (fn []) -> <msecs> NB: generator always returns an event immediately on call, meaning the consumer can control the rate of events by calling generator more or less frequently.
(get-next-time delay-ms)
(uuid-str)
A small utility to return a string uuid.
A small utility to return a string uuid.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close