WARN_SIGMA
WARN_SIGMA = 4.0
Deviations from the median before a departure is worth a warning.
Scores the newest reading of each measurement against the site's own earlier readings.
A threshold that is right for one site is wrong for another, so nothing here is compared
against an absolute number. A site doing four operations an hour and a site doing four hundred
thousand both have a normal, and the only useful question is whether today looks like their own
yesterday. Every judgement is therefore relative to the series in MetricSampler's window.
Findings go through the same ledger as every tripwire, so an anomaly appears on the health
dashboard beside a missing frame and inherits the repair ladder, the circuit breaker and the
notification channel rather than getting a parallel set of its own. The rung stays at observe:
an unusual number is a reason to look, never a reason to repair.
Two measurements are directional and the rest are not. A compression ratio and a deduplication ratio going UP is the pipeline working better, so only a fall is reported. An operation rate, a stored-byte total and a chain depth are reported in both directions - a site that suddenly stops capturing is as interesting as one that suddenly captures far more, and it is the failure mode a one-sided detector would miss entirely.
$sampler : \Drupal\strata\Anomaly\MetricSampler
$ledger : \Drupal\strata\Health\HealthLedgerInterface
$notifier : ?\Drupal\strata\Event\Notifier
__construct(\Drupal\strata\Anomaly\MetricSampler $sampler, \Drupal\strata\Health\HealthLedgerInterface $ledger, \Psr\Log\LoggerInterface $logger, \Drupal\strata\Event\Notifier|null $notifier = null, float $warnAt = \self::WARN_SIGMA) : mixed
Constructs a detector.
| \Drupal\strata\Anomaly\MetricSampler | $sampler | Takes the reading and holds the window. |
| \Drupal\strata\Health\HealthLedgerInterface | $ledger | Where an anomaly is recorded. |
| \Psr\Log\LoggerInterface | $logger | Records what was found. |
| \Drupal\strata\Event\Notifier|null | $notifier | Announces each anomaly, or NULL to stay silent. |
| float | $warnAt | Deviations before a warning, so a site can widen or tighten the band. |
run(bool $record = true) : list<\Drupal\strata\Anomaly\Anomaly>
Takes a reading and reports what departed from the window before it.
| bool | $record | FALSE to score without writing findings, which is what the dashboard's preview does. |
What departed, worst first.
current() : list<\Drupal\strata\Anomaly\Anomaly>
Scores the window as it stands, without taking a reading or writing anything.
What a dashboard calls. run() samples first, so rendering a page through it would append a
reading on every page load and move the baseline every time somebody looked at it.
What departed, worst first.
score(string $metric) : \Drupal\strata\Anomaly\Anomaly|null
Scores one measurement's newest reading.
| string | $metric | A key of |
The anomaly, or NULL when the series is too short, the reading is ordinary, or the measurement moved in the direction that is not a symptom.