Skip to main content

normalize

Function normalize 

Source
pub fn normalize(file: ScenarioFile) -> Result<NormalizedFile, NormalizeError>
Expand description

Resolve the defaults: block into every entry of a parsed v2 scenario file.

The returned NormalizedFile contains a NormalizedEntry per input entry with the following fields materialized:

  • rate inherits from defaults.rate when the entry omits it; missing on both is an error (see NormalizeError::MissingRate).
  • duration inherits from defaults.duration; absence is preserved as “run until stopped”.
  • encoder inherits from defaults.encoder, otherwise defaults to prometheus_text for metrics/histogram/summary and json_lines for logs.
  • sink inherits from defaults.sink, otherwise defaults to stdout.
  • labelsinline entries only: the union of defaults.labels and the entry’s labels (entry wins on conflict). Pack entries keep their own labels unchanged; defaults.labels is surfaced on NormalizedFile::defaults_labels for Phase 3 pack expansion.

All other fields (pack info, histogram parameters, after clause, phase_offset, clock_group, jitter, gaps, bursts, cardinality spikes, dynamic labels, etc.) are carried through untouched.

§Errors

Returns NormalizeError::MissingRate when an entry has no rate defined inline and the defaults: block does not supply one either. The error message identifies the entry by index and, when available, its name, id, or pack reference.