API Reference¶
FastMCP server factory, run registry, event models, and configuration types used by the MCP tools and resources.
Server¶
Registry¶
Events¶
-
class rampa.events.RunResultclass rampa.events.RunResult
Bases:
objectResult of a completed test run.
>>> r = RunResult( ... run_id="abc", ... status=RunStatus.PASSED, ... snapshot=None, ... threshold_results=[], ... ) >>> r.status <RunStatus.PASSED: 'passed'>
-
class rampa.events.RunStatusclass rampa.events.RunStatus
Bases:
StrEnumFinal status of a completed test run.
>>> RunStatus.PASSED.value 'passed' >>> RunStatus.THRESHOLD_FAILED.value 'threshold_failed'
-
class rampa.events.PhaseEventclass rampa.events.PhaseEvent
Bases:
EngineEventLifecycle phase transition.
>>> e = PhaseEvent(run_id="abc", timestamp_ns=0, phase="setup") >>> e.phase 'setup'
-
class rampa.events.SnapshotEventclass rampa.events.SnapshotEvent
Bases:
EngineEventPeriodic metric snapshot.
>>> from rampa.metrics import MetricSnapshot >>> snap = MetricSnapshot(timestamp=0, duration=1.0, values={}) >>> e = SnapshotEvent(run_id="x", timestamp_ns=0, snapshot=snap) >>> e.snapshot.duration 1.0
-
class rampa.events.ThresholdEventclass rampa.events.ThresholdEvent
Bases:
EngineEventThreshold evaluation results.
>>> e = ThresholdEvent(run_id="x", timestamp_ns=0, results=[]) >>> len(e.results) 0
Configuration¶
-
class rampa.config.Configclass rampa.config.Config
Bases:
BaseModelTop-level test configuration.
Either
scenariosor shortcut options (vus,duration, etc.) may be provided, but not both.>>> import datetime >>> cfg = Config( ... scenarios={"smoke": ScenarioConfig( ... executor="constant-vus", ... vus=1, ... duration=datetime.timedelta(seconds=10), ... )}, ... ) >>> "smoke" in cfg.scenarios True >>> cfg.scenarios["smoke"].executor 'constant-vus'
-
class rampa.config.ScenarioConfigclass rampa.config.ScenarioConfig
Bases:
BaseModelConfiguration for a single test scenario.
Each scenario maps to an executor that controls how iterations are scheduled. Executor-specific fields are validated by the executor, not by this model.
>>> import datetime >>> cfg = ScenarioConfig( ... executor="constant-vus", ... vus=10, ... duration=datetime.timedelta(seconds=30), ... ) >>> cfg.executor 'constant-vus' >>> cfg.vus 10
-
class rampa.config.Stageclass rampa.config.Stage
Bases:
BaseModelA single ramp stage with a target VU or rate count and duration.
>>> import datetime >>> Stage( ... duration=datetime.timedelta(seconds=30), target=100, ... ).target 100 >>> Stage( ... duration=datetime.timedelta(minutes=1), target=0, ... ).duration datetime.timedelta(seconds=60)
Metrics¶
-
class rampa.metrics.MetricSnapshotclass rampa.metrics.MetricSnapshot
Bases:
objectFrozen snapshot of aggregated metric values at a point in time.
>>> snap = MetricSnapshot( ... timestamp=0, ... duration=10.0, ... values={"reqs": {"count": 100.0, "rate": 10.0}}, ... ) >>> snap.values["reqs"]["rate"] 10.0
-
class rampa.thresholds.ThresholdResultclass rampa.thresholds.ThresholdResult
Bases:
objectResult of evaluating one threshold.
>>> r = ThresholdResult(source="p(95)<500", passed=True, lhs=450.0, rhs=500.0) >>> r.passed True
-
class rampa.thresholds.ThresholdExpressionclass rampa.thresholds.ThresholdExpression
Bases:
objectA parsed threshold expression.
>>> expr = parse_threshold("p(95)<500") >>> expr.aggregation 'p(95)' >>> expr.operator '<' >>> expr.value 500.0