1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//! Karga — a small, flexible load-testing framework for Rust.
//!
//! Karga is inspired by the design of Serde (a slim core with pluggable extensions)
//! and by tools such as K6, RLT, and Goose for practical load-testing concerns.
//!
//! The library is intentionally minimal: you provide small building blocks (metrics,
//! aggregates, reporters, executors) and compose them into a `Scenario`. For convenience,
//! there are a few built-in implementations that cover common use cases.
//!
//! # Architecture
//!
//! The main building blocks are:
//!
//! - [`Scenario`]: configuration object that defines the action to be executed
//! - [`Executor`]: responsible for actually running the scenario. Executors control
//! concurrency, scheduling, and are the primary place where performance matters. We provide
//! a high-performance `StageExecutor`, but executors are replaceable.
//! - [`Metric`]: the smallest unit produced by an action. A scenario’s action returns a
//! `Metric` describing a single sample.
//! - [`Aggregate`]: a lightweight, specialized collector that knows how to process
//! `Metric`s into a compact intermediate representation.
//! - [`Report`]: transforms an `Aggregate` into human- or machine-friendly output.
//! - [`Reporter`]: consumes `Report`s and sends them somewhere (stdout, file, database).
//!
//! # Design goals
//!
//! - Small, well-documented core that is easy to extend.
//! - High performance in the executor layer — low allocation overhead and efficient
//! scheduling are the primary optimizations.
//! - Composability: users can supply their own metrics/aggregates/reporters or use the
//! built-ins for convenience.
//!
//! # Example
//!
//! A simple HTTP example:
//!
//!```rust,no_run
//!```
//!
//! This example demonstrates how Karga combines a simple scenario, a configurable executor,
//! and built-in reporting to form a full benchmark pipeline.
//!
//! # Feature flags
//!
//! common traits and registration. (Enabled by default)
//! - `builtins`: provides basic implementations (`BasicMetric`, `BasicAggregate`,
//! `BasicReport`, `StdoutReporter`) for quick experiments and demos. (Enabled by default)
//!
//! # Where to start
//!
//! - Read the docs for [`Scenario`], [`Executor`], and [`Reporter`]. Each core trait should
//! include an `# Examples` section that compiles and demonstrates a minimal implementation.
//! - See `examples/` for runnable scenarios (recommended: `examples/http.rs`).
/// Metric aggregators
/// Orchestrators that define how things will actually run
/// Single metrics
/// Reports and Reporters
/// Main module of the framework that glues everything together
pub use Aggregate;
pub use ;
pub use Metric;
pub use ;
pub use Scenario;