Skip to content

assertions

Model assertions: a KPI, a comparison operator/value and a replication/confidence budget, checked by naga check.

In the model file this key holds a list of entries.

Typical uses

These sections guard and present a model. assertions check that a KPI stays on the right side of a bound. path_checks check which blocks entities visit. A dashboard defines the tiles, gauges and charts that a viewer sees, and the inputs a viewer may change. Use the first two as tests of a model, and the third for people who did not build it.

Behaviour and rules

An assertion names a KPI key, an operator and a value. It passes only when the whole confidence interval over its replications clears the bound, at the given confidence. The operator == means inside the value plus or minus tolerance. naga check runs the assertions, and assertions with the same replication count run together.

A path check has one of four rules. order needs an entity to reach a first block before a later one. never forbids a block. at_most limits the visits. always requires that every entity that left through a DISPOSE visited the block. A path check is judged on one traced replication.

A dashboard widget is an expression sampled at the same instants as the time series. Without pages, the dashboard that Present mode shows is generated from the model. The limits cap what a run started by a viewer may cost.

Fields

Field Type Required Default Unit Description
name string yes The assertion's name, as the check lists it.
description string What the assertion guards; the run does not read it.
kpi string yes A KPI key from experiments.flatten_kpis, e.g. "system/Throughput (per time unit)" or "resource/Server/Usage % (snapshot)".
op choice yes Passes when the WHOLE confidence interval clears the bound ("==" means inside value +/- tolerance). One of <, <=, >, >=, ==.
value number yes The number the KPI is compared with.
replications integer 5 Assertions sharing a replication count are run in one batch.
confidence number 0.95 The confidence level of the interval the comparison uses.
tolerance number 0 Half-width of the "==" band around value; ignored by the other operators.

A field of a nested object is described in the JSON Schema (naga schema).

Example

{"assertions": [{"name": "Server below 90 percent", "kpi": "resource/Server/Utilization", "op": "<", "value": 0.9}]}

In the Python builder the section is a keyword of Model:

from nagasim import build as nb
m = nb.Model(assertions=[{'name': 'Server below 90 percent', 'kpi': 'resource/Server/Utilization', 'op': '<', 'value': 0.9}])

Used in

Guides: How do I check a model in continuous integration?, Model assertions and CI.

See also