Skip to main content

Generator configuration

discard

Commentary​

added in 0.0.34

local configuration

global configuration

The rate at which to generate an event and not send it to the associated connection.


Examples​

Local configuration​

Use localConfigs to set discard locally for one generator.

{
"generators": [
{
"table": "orders",
"row": {
"orderId": {
"_gen": "uuid"
},
"orderDate": {
"_gen": "dateToday"
}
},
"localConfigs": {
"discard": {
"rate": 0.05
}
}
}
]
}

Global configuration​

Use globalConfigs to set discard globally for all generators.

{
"generators": [
{
"table": "orders",
"row": {
"orderId": {
"_gen": "uuid"
},
"orderDate": {
"_gen": "dateToday"
}
}
}
],
"globalConfigs": {
"localConfigs": {
"discard": {
"rate": 0.02
}
}
}
}

Retain history​

If you want to simulate a generator believing that it sent data, but actually discarding it, set retainHistory to true.

This will cause all discarded events to get saved to history, so when other generators look up data against it, it will provide those events.

In the example below, a discards 20% of its events, but b is able to look up all of it: the 80% actually sent, plus the 20% it dropped.

{
"generators": [
{
"topic": "a",
"value": {
"_gen": "boolean"
},
"localConfigs": {
"discard": {
"rate": 0.2,
"retainHistory": true
}
}
},
{
"topic": "b",
"value": {
"_gen": "lookup",
"topic": "a",
"path": [
"value"
]
}
}
]
}

Specification​

JSON schema​

{
"type": "object",
"properties": {
"rate": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"retainHistory": {
"type": "boolean"
}
},
"required": [
"rate"
]
}