BlyxDocumentation
Browse chapters
Documentation / Workflow recipes

Raven · Budget a log buffer during an error burst

Budget a bounded log buffer while preserving higher-severity events first.

Budget a log buffer during an error burst

A burst of low-severity messages can consume all available slots. Quantify how much high-severity evidence a bounded buffer would retain. Three records cross the importance threshold, but the buffer has two slots. One high-severity record must be dropped.

Run the framework with your own input

Install Blyx 0.2.1 and a Rust toolchain with a host linker, then run the versioned project. Each positional argument is a number or a comma-separated numerical vector. The CLI accepts up to 16 entries per vector. The imported module accepts longer inputs.

git clone --depth 1 --branch v0.1.0 https://github.com/Rahulchaube1/blyx-raven.git
cd blyx-raven
blyxc native-run project.blyx -- "9,17,9,21,21" 17 2

API and return values

Returns [important retained, ordinary retained, dropped, high-severity drops]. Use the plan to allocate slots in a host logger. Invalid input returns an empty vector.

ArgumentAccepted input
severityVector of: nonnegative exact integer
thresholdnonnegative exact integer
capacitynonnegative exact integer

Use the libraries independently

The framework vendors the same library source published in these two repositories. Each module has its own package page, input contract and regression suite.

Try the program

Output Ready
Expected output
2
0
3
1
Open in the full playground →

Practice

Change severity = [9, 17, 9]. Predict the result, then run the program.

Hint

Returns [important retained, ordinary retained, dropped, high-severity drops]. Use the plan to allocate slots in a host logger.

Worked solution

The result vector is [1, 1, 1, 0]. Compare its fields with the return layout in the API section.

Find

    let severity = [9, 17, 9, 21, 21];

Replace with

    let severity = [9, 17, 9];

Output after the change

1
1
1
0