Skip to main content

Crate sonda_core

Crate sonda_core 

Source
Expand description

sonda-core — the engine for synthetic telemetry generation.

This crate owns all domain logic: telemetry models, value generators, schedulers, encoders, and sinks. The CLI and HTTP server are thin layers that call into this library.

§Stability

Public enums and structs on the library surface — including SondaError and its sub-enums (ConfigError, GeneratorError, EncoderError, RuntimeError), the config enums (GeneratorConfig, EncoderConfig, SinkConfig, DistributionConfig, ScenarioEntry), the compile-phase error enums under compiler, and ScenarioStats — are marked #[non_exhaustive]. Downstream consumers that match on these types must include a wildcard _ => arm, and ScenarioStats must be constructed via Default::default() plus field updates rather than a struct literal. This lets sonda-core add new variants and fields in a minor release without a semver-major bump.

Re-exports§

pub use config::aliases::desugar_entry;
pub use config::aliases::desugar_scenario_config;
pub use config::BaseScheduleConfig;
pub use config::BurstConfig;
pub use config::CardinalitySpikeConfig;
pub use config::DistributionConfig;
pub use config::DynamicLabelConfig;
pub use config::DynamicLabelStrategy;
pub use config::HistogramScenarioConfig;
pub use config::LogScenarioConfig;
pub use config::OnSinkError;
pub use config::ScenarioEntry;
pub use config::SpikeStrategy;
pub use config::SummaryScenarioConfig;
pub use config::expand_entry;
pub use config::expand_scenario;
pub use model::log::LogEvent;
pub use model::log::Severity;
pub use model::metric::Labels;
pub use model::metric::MetricEvent;
pub use model::metric::ValidatedMetricName;
pub use scenarios::BuiltinScenario;
pub use schedule::handle::ScenarioHandle;
pub use schedule::launch::launch_scenario;
pub use schedule::launch::prepare_entries;
pub use schedule::launch::validate_entry;
pub use schedule::launch::PreparedEntry;
pub use schedule::stats::ScenarioState;
pub use schedule::stats::ScenarioStats;
pub use compiler::prepare::PrepareError;

Modules§

compiler
Version 2 scenario format: AST types and parser.
config
Scenario configuration types and validation.
emit
Synchronous single-event emission.
encoder
Encoders serialize telemetry events into wire format bytes.
generator
Value generators produce f64 values for each tick.
model
packs
Metric pack engine: types and expansion logic.
scenarios
Scenario metadata types for the built-in scenario catalog.
schedule
Scheduling: rate control, duration, gap windows, burst windows.
sink
Sinks deliver encoded byte buffers to their destination.

Enums§

CompileError
Errors produced by compile_scenario_file.
ConfigError
Errors related to scenario configuration validation.
EncoderError
Errors during event encoding (serialization, timestamp conversion, protobuf).
GeneratorError
Errors originating from value or log generators.
RuntimeError
Runtime and system errors outside the user’s control.
SondaError
Top-level error type for sonda-core.

Functions§

compile_scenario_file
Compile a v2 scenario YAML into the runtime’s Vec<ScenarioEntry> input shape.
compile_scenario_file_compiled
Compile a v2 scenario YAML to a CompiledFile, preserving while: / delay: clauses for the gated multi-runner.