Usage
Using Collated Signals in Fitness Functions
In order to utilize the Collator's grouped and processed signals, you need to configure your Fitness Function to use the collated data as a sensor source. This process involves adjusting the sensor to be collator://fitness.orcasio.net/buffer and matching the source with the one specified in the Collator's configuration.
For example, let's consider the following Collator configuration:
kind: FitnessCollator
apiVersion: fitness.orcasio.com/v1alpha3
metadata:
name: buffer-cron
namespace: orcas
spec:
collator: collator://fitness.orcasio.net/buffer
trigger:
sensor: sensor://fitness.orcasio.net/kubernetes
source: deployment
bufferPeriod: "0 0 0 1 * *"
reconciliationPeriod: "0 * * * * *"
reconciliationKeys:
- kind
- metadata.name
enabled: true
mergeTags: true
To process the collated signals, create a Fitness Function as follows:
kind: FitnessFunction
apiVersion: fitness.orcasio.com/v1alpha3
metadata:
name: avail-deploy
namespace: orcas
spec:
sensor: collator://fitness.orcasio.net/buffer
source: deployment
# ... rest of the function definition
The collated signal generated by the Collator will look something like this:
{
"kind": "FitnessSignal",
"apiVersion": "fitness.orcasio.com/v1alpha3",
"metadata": {
"name": "orcas-signal-1692796205038",
"namespace": "orcas",
"creationTimestamp": "2023-08-23T13:10:05Z"
},
"spec": {
"sensor": "collator://fitness.orcasio.net/buffer",
"sensorId": "bbff7073-866f-4fa5-b24b-96b29a905cf6",
"source": "deployment",
"group": "buffer-cron",
"time": "2023-08-23T13:08:16Z",
"tags": {
"abc": "def"
},
"data": {
"collatedSignals": [
{
"data": { "<signal_data>" },
"tags": { "<signal_tags>" },
"time": "<signal_time>"
},
{
"data": { "<signal_data>" },
"tags": { "<signal_tags>" },
"time": "<signal_time>"
}
],
"reconciliationKey": "<reconciliationKey>",
"startTime": "2023-08-23T13:08:00Z",
"stopTime": "2023-08-23T13:10:00Z"
}
},
"status": { "state": "", "reason": "", "time": null }
}
The collatedSignals array within the data section contains the grouped signals that share the same reconciliation key and were processed together.