Behaviours: supervisor.
ask_opt() = {max_rate, non_neg_integer() | infinity}
ask/2 | Ask Category to sample an EventType event. |
ask/3 | Ask Category to sample an EventType event using custom function or overridden options. |
ask/4 | Ask Category to sample an EventType event using custom function and overridden options. |
child_spec/1 | Declare a deigma instance named Category under your own supervisor. |
start/1 | Start a deigma instance named Category |
start_link/1 | Start a deigma instance named Category under your own supervisor. |
stop/1 | Stop a deigma instance named Category |
ask(Category, EventType) -> {Decision, SamplingPercentage}
Ask Category
to sample an EventType
event
Category
must be an atom and correspond to an existing deigma instanceEventType
can be any term{sample, SamplingPercentage}
if the event was sampled{drop, SamplingPercentage}
if the event was droppedSamplingPercentage
is a floating point number between 0.0 and 1.0 representing
the percentage of events that were sampled during the last 1000 milliseconds,
including the event reported just now.
ask(Category, EventType, EventFun::EventFun | Opts) -> {Decision, SamplingPercentage} | EventFunResult
Ask Category
to sample an EventType
event using custom function or overridden options
Category
must be an atom and correspond to an existing deigma instanceEventType
can be any termEventFun
must be a function which will receive the following arguments:
Timestamp
: Monotonic timestamp in native units at which the event was registeredDecision
: Either sample
or drop
depending on whether the event was sampled or notSamplingPercentage
: a floating point number between 0.0 and 1.0 representing the percentage
of events that were sampled during the last 1000 milliseconds, including the event
reported just now.
EventType
, which means
it can be used for fullfilling serialisation constraints; at the same time,
performance has to be taken into account (lest the event window become a bottleneck.)
Opts
must be a list of ask_opt()
items:
max_rate, MaxRate}
: don't sample more than MaxRate
EventType
events per
second (defaults to 100
)
EventFun
, it will return or throw whathever EventFun
returns or throws.
If called with Opts
, it will return the same as :ask/2
.
ask(Category, EventType, EventFun, Opts) -> EventFunResult
Ask Category
to sample an EventType
event using custom function and overridden options
Category
must be an atom and correspond to an existing deigma instanceEventType
can be any termEventFun
must be a function which will receive the following arguments:
Timestamp
: Monotonic timestamp in native units at which the event was registeredDecision
: Either sample
or drop
depending on whether the event was sampled or notSamplingPercentage
: a floating point number between 0.0 and 1.0 representing the percentage
of events that were sampled during the last 1000 milliseconds, including the event
reported just now.
EventType
, which means
it can be used for fullfilling serialisation constraints; at the same time,
performance has to be taken into account (lest the event window become a bottleneck.)
Opts
must be a list of ask_opt()
items:
max_rate, MaxRate}
: don't sample more than MaxRate
EventType
events per
second (defaults to 100
)
EventFun
returns or throws.
child_spec(Category) -> supervisor:child_spec()
Declare a deigma instance named Category
under your own supervisor
Category
must be an atomSee also: start/1, start_link/2.
start(Category) -> {ok, pid()} | {error, term()}
Start a deigma instance named Category
Category
must be an atomSee also: child_spec/1, start_link/1, stop/1.
start_link(Category) -> {ok, pid()} | {error, term()}
Start a deigma instance named Category
under your own supervisor
Category
must be an atomSee also: child_spec/1, start/1.
stop(Category) -> ok | {error, not_started}
Stop a deigma instance named Category
Category
must be an atomSee also: child_spec/1, start_link/1, stop/1.
Generated by EDoc, Jun 17 2018, 17:43:00.