StatsActor

The StatsActor (statistics actor) is a Coral Actor that gathers a single real valued field from its trigger JSON. It saves a number of statistics as state for this field.

Creating a StatsActor

The StatsActor has "type": "stats". The params value is a JSON with a single field:

field type required description
field string yes the name of the field in the trigger-JSON to collect statistics for.

Example

{
  "data": {
    "type": "actors",
    "attributes": {
      "type": "stats",
      "params": {
        "field": "amount"
      }
    }
  }
}

This will create a statistics component monitoring the field “amount”.

Trigger

The StatsActor only does useful work if the trigger is connected. The actor gathers values supplied by the field specified in the parameters.

Emit

The StatsActor emits nothing. The state of the actor should be gathered by another actor through a collect procedure.

State

The StatsActor keeps the following summary statistics as state:

field type description
count integer number of values processed
avg float the average value
sd float the (population) standard deviation
min float the minimum value
max float the maximum value


The state is updated every time a value for the specified field is encountered in the trigger. Note that when no events have occurred the count is zero, and other fields are undefined. This is represented as null in the JSON representation of the state.

Collect

The StatsActor does not collect state from other actors.

Timer

The StatsActor does not provide timer actions.