Skip to main content

GeneratorConfig

Enum GeneratorConfig 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Constant

A generator that always returns the same value.

Fields

§value: f64

The fixed value returned on every tick.

§

Uniform

A generator that returns deterministically random values in [min, max].

Fields

§min: f64

Lower bound of the output range (inclusive).

§max: f64

Upper bound of the output range (inclusive).

§seed: Option<u64>

Optional seed for deterministic replay. Defaults to 0 when absent.

§

Sine

A generator that follows a sine curve.

Fields

§amplitude: f64

Half the peak-to-peak swing of the wave.

§period_secs: f64

Duration of one full cycle in seconds.

§offset: f64

Vertical offset applied to every sample (the wave’s midpoint).

§

Sawtooth

A generator that linearly ramps from min to max then resets.

Fields

§min: f64

Value at the start of each period.

§max: f64

Value approached at the end of each period (never reached).

§period_secs: f64

Duration of one full ramp in seconds.

§

Sequence

A generator that steps through an explicit sequence of values.

Fields

§values: Vec<f64>

The ordered list of values to step through. Must not be empty.

§repeat: Option<bool>

When true (default), the sequence cycles. When false, the last value is returned for all ticks beyond the sequence length.

§

Spike

A generator that outputs a baseline value with periodic spikes.

Fields

§baseline: f64

The normal output value between spikes.

§magnitude: f64

The amount added to baseline during a spike.

§duration_secs: f64

How long each spike lasts in seconds.

§interval_secs: f64

Time between spike starts in seconds.

§

CsvReplay

A generator that replays numeric values from a CSV file.

Fields

§file: String

Path to the CSV file containing numeric values.

§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.

§repeat: Option<bool>

Whether to loop back to the first value after exhausting the CSV. Defaults to true.

§

Step

A monotonic step counter: start + tick * step_size, with optional wrap-around.

Useful for testing rate() and increase() PromQL functions.

Fields

§start: Option<f64>

Initial value at tick 0. Defaults to 0.0 when absent.

§step_size: f64

Increment applied per tick.

§max: Option<f64>

Optional wrap-around threshold. When set and greater than start, the value wraps via modular arithmetic.

§

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.0

Fields

§up_duration: Option<String>

How long the signal stays in the “up” state per cycle. Defaults to "10s".

§down_duration: Option<String>

How long the signal stays in the “down” state per cycle. Defaults to "5s".

§up_value: Option<f64>

Value emitted during the “up” state. Defaults to 1.0.

§down_value: Option<f64>

Value emitted during the “down” state. Defaults to 0.0.

§enum_kind: Option<FlapEnum>

Domain-specific shorthand selecting (up_value, down_value) per the FlapEnum mapping. Mutually exclusive with up_value / down_value.

§

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

§baseline: Option<f64>

Resource level at the start of each cycle. Defaults to 0.0.

§ceiling: Option<f64>

Maximum resource level before reset. Defaults to 100.0.

§time_to_saturate: Option<String>

Duration of one fill cycle. Defaults to "5m".

§

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_ceiling should be >= scenario duration. 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

§baseline: Option<f64>

Initial resource level. Defaults to 0.0.

§ceiling: Option<f64>

Target ceiling value. Defaults to 100.0.

§time_to_ceiling: Option<String>

Time to grow from baseline to ceiling. Defaults to "10m". The sawtooth period is set to this value so values only ramp upward within the scenario duration.

§

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.02

Fields

§baseline: Option<f64>

Starting performance level. Defaults to 0.0.

§ceiling: Option<f64>

Worst-case performance level. Defaults to 100.0.

§time_to_degrade: Option<String>

Duration of the degradation ramp. Defaults to "5m".

§noise: Option<f64>

Jitter amplitude added as noise. Defaults to 1.0.

§noise_seed: Option<u64>

Seed for the noise generator. Defaults to 0.

§

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.0

Fields

§center: Option<f64>

Center of the oscillation (the sine wave’s offset). Defaults to 50.0.

§amplitude: Option<f64>

Half the peak-to-peak swing. Defaults to 10.0.

§period: Option<String>

Duration of one full oscillation cycle. Defaults to "60s".

§noise: Option<f64>

Jitter amplitude added as noise. Defaults to 1.0.

§noise_seed: Option<u64>

Seed for the noise generator. Defaults to 0.

§

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

§baseline: Option<f64>

Normal output value between spikes. Defaults to 0.0.

§spike_height: Option<f64>

Amount added to baseline during a spike. Defaults to 100.0.

§spike_duration: Option<String>

How long each spike lasts. Defaults to "10s".

§spike_interval: Option<String>

Time between spike starts. Defaults to "30s".

Implementations§

Source§

impl GeneratorConfig

Source

pub fn is_alias(&self) -> bool

Returns true if this variant is an operational alias that must be desugared before the generator factory can process it.

Trait Implementations§

Source§

impl Clone for GeneratorConfig

Source§

fn clone(&self) -> GeneratorConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GeneratorConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for GeneratorConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for GeneratorConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,