The SampleActor (sample actor) is a Coral Actor that only emits a fraction of the supplied JSON trigger messages. The fraction can be specified by the user. The selection of messages to pass is random, but such that on average in the long term the fraction passed corresponds to the specified fraction.
The SampleActor has type: "sample". The params value is a JSON with two optional fields:
| field | type | required | description |
|---|---|---|---|
fraction |
float | yes | the fraction of messages to be passed (range 0 to 1). |
{
"data": {
"type": "actors",
"attributes": {
"type": "sample",
"params": {
"fraction": 0.125
}
}
}
}This will create a sample actor that passes 12.5% of all messages.
The SampleActor only does useful work if the trigger is connected.
The actor does nothing with the supplied JSON but just passes it through (or not).
The SampleActor emits the received JSON with probability equal to the supplied fraction.
The SampleActor does not keep state.
The SampleActor does not collect state from other actors.
The SampleActor does not provide timer actions.