#[non_exhaustive]pub enum GeneratorConfig {
Show 14 variants
Constant {
value: f64,
},
Uniform {
min: f64,
max: f64,
seed: Option<u64>,
},
Sine {
amplitude: f64,
period_secs: f64,
offset: f64,
},
Sawtooth {
min: f64,
max: f64,
period_secs: f64,
},
Sequence {
values: Vec<f64>,
repeat: Option<bool>,
},
Spike {
baseline: f64,
magnitude: f64,
duration_secs: f64,
interval_secs: f64,
},
CsvReplay {
file: String,
column: Option<usize>,
columns: Option<Vec<CsvColumnSpec>>,
repeat: Option<bool>,
},
Step {
start: Option<f64>,
step_size: f64,
max: Option<f64>,
},
Flap {
up_duration: Option<String>,
down_duration: Option<String>,
up_value: Option<f64>,
down_value: Option<f64>,
enum_kind: Option<FlapEnum>,
},
Saturation {
baseline: Option<f64>,
ceiling: Option<f64>,
time_to_saturate: Option<String>,
},
Leak {
baseline: Option<f64>,
ceiling: Option<f64>,
time_to_ceiling: Option<String>,
},
Degradation {
baseline: Option<f64>,
ceiling: Option<f64>,
time_to_degrade: Option<String>,
noise: Option<f64>,
noise_seed: Option<u64>,
},
Steady {
center: Option<f64>,
amplitude: Option<f64>,
period: Option<String>,
noise: Option<f64>,
noise_seed: Option<u64>,
},
SpikeEvent {
baseline: Option<f64>,
spike_height: Option<f64>,
spike_duration: Option<String>,
spike_interval: Option<String>,
},
}Expand description
Configuration for a value generator, used for YAML deserialization.
The type field selects which generator to instantiate. Additional fields
are specific to each variant.
§Core generators
generator:
type: sine
amplitude: 5.0
period_secs: 30
offset: 10.0§Operational aliases
Aliases desugar into core generators at config expansion time. They use domain-relevant parameter names and have sensible defaults.
# Normal healthy oscillation (desugars to sine + jitter)
generator:
type: steady
center: 75.0
amplitude: 10.0
period: "60s"
noise: 2.0
# Resource leak (desugars to sawtooth)
generator:
type: leak
baseline: 40.0
ceiling: 95.0
time_to_ceiling: "120s"
# Interface flap (desugars to sequence)
generator:
type: flap
up_duration: "10s"
down_duration: "5s"Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Constant
A generator that always returns the same value.
Uniform
A generator that returns deterministically random values in [min, max].
Fields
Sine
A generator that follows a sine curve.
Fields
Sawtooth
A generator that linearly ramps from min to max then resets.
Fields
Sequence
A generator that steps through an explicit sequence of values.
Fields
Spike
A generator that outputs a baseline value with periodic spikes.
Fields
CsvReplay
A generator that replays numeric values from a CSV file.
Fields
column: Option<usize>Internal: zero-based column index, set by expand_scenario.
Not user-facing in YAML — set during config expansion. When
None, defaults to 0 at generator creation time.
columns: Option<Vec<CsvColumnSpec>>Explicit column specifications. When present, the config layer expands this single scenario into N independent single-column scenarios before launch.
When absent, columns are auto-discovered from the CSV header row. An empty list is an error.
Step
A monotonic step counter: start + tick * step_size, with optional wrap-around.
Useful for testing rate() and increase() PromQL functions.
Fields
Flap
Binary up/down toggle modeling an interface flap.
Desugars into a Sequence generator that
alternates between up_value (default 1.0) and down_value (default 0.0).
The number of consecutive up/down ticks is derived from up_duration and
down_duration relative to the scenario rate.
The optional enum: shorthand selects up/down values aligned with
common gNMI / openconfig conventions (oper-state, admin-state,
BGP neighbor-state). Mutually exclusive with explicit up_value /
down_value.
§Example YAML
generator:
type: flap
up_duration: "10s"
down_duration: "5s"
enum: oper_state # up_value=1.0, down_value=2.0Fields
up_duration: Option<String>How long the signal stays in the “up” state per cycle.
Defaults to "10s".
Saturation
Resource filling up and resetting on a repeating cycle (e.g. disk usage sawtoothing after log rotation).
Desugars into a Sawtooth generator with
min = baseline, max = ceiling, period_secs derived from
time_to_saturate. The sawtooth resets to baseline after each
time_to_saturate period, modeling a resource that fills and is
periodically reclaimed.
§Distinction from Leak
- Saturation: repeating fill-and-reset cycle. Default period is
"5m". - Leak: one-way ramp, no reset expected within the scenario
duration. Default period is
"10m".
§Example YAML
generator:
type: saturation
baseline: 20.0
ceiling: 95.0
time_to_saturate: "5m"Fields
Leak
Resource growing toward a ceiling without resetting — a one-way ramp modeling a memory leak or similar resource exhaustion.
Desugars into a Sawtooth generator.
The intent is that time_to_ceiling equals or exceeds the scenario
duration so values only ramp upward and never reset within the run.
If the scenario has a duration set and time_to_ceiling is shorter
than that duration, desugaring returns a config error because the
sawtooth would reset mid-run, which is the
Saturation pattern instead.
§Distinction from Saturation
- Leak: one-way ramp, no reset expected.
time_to_ceilingshould be >= scenarioduration. Default period is"10m". - Saturation: repeating fill-and-reset cycle. Default period is
"5m".
§Example YAML
generator:
type: leak
baseline: 40.0
ceiling: 95.0
time_to_ceiling: "120s"Fields
Degradation
Gradual performance loss with noise — models degradation over time (e.g. growing latency, increasing error rate).
Desugars into a Sawtooth generator with
jitter automatically applied on [BaseScheduleConfig].
§Example YAML
generator:
type: degradation
baseline: 0.05
ceiling: 0.5
time_to_degrade: "60s"
noise: 0.02Fields
Steady
Normal healthy oscillation around a center value — the “everything is fine” baseline signal.
Desugars into a Sine generator with jitter
automatically applied on [BaseScheduleConfig].
§Example YAML
generator:
type: steady
center: 75.0
amplitude: 10.0
period: "60s"
noise: 2.0Fields
SpikeEvent
Periodic anomalous bursts above a baseline — models sudden spikes in CPU, memory, or request rate.
Desugars into a Spike generator.
§Example YAML
generator:
type: spike_event
baseline: 35.0
spike_height: 60.0
spike_duration: "10s"
spike_interval: "30s"Fields
Implementations§
Trait Implementations§
Source§impl Clone for GeneratorConfig
impl Clone for GeneratorConfig
Source§fn clone(&self) -> GeneratorConfig
fn clone(&self) -> GeneratorConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more