\Drupal\strata\Anomaly Anomaly

One measurement that departed from its own history.

Carries the numbers rather than a verdict, so an operator reading the finding can see what the baseline was and decide whether the departure is a fault or a busy afternoon. A detector that reported only "op rate is unusual" would be unactionable.

Summary

Methods
Properties
Constants
__construct
direction
severity
toFinding
describe
jsonSerialize
metric
label
observed
baseline
deviations
samples
unit
CODE
No protected methods found
No protected properties found
No protected constants found
render
No private properties found
No private constants found

Constant

CODE

CODE = 'anomaly.detected'

The finding code every anomaly is recorded under.

Properties

$metric

$metric : string

Type

string

$label

$label : string

Type

string

$observed

$observed : float

Type

float

$baseline

$baseline : float

Type

float

$deviations

$deviations : float

Type

float

$samples

$samples : int

Type

int

$unit

$unit : string

Type

string

Methods

__construct()

__construct(string  $metric, string  $label, float  $observed, float  $baseline, float  $deviations, int  $samples, string  $unit = '') : mixed

Constructs an anomaly.

Parameters

string $metric

Which measurement departed, such as "op_rate".

string $label

The measurement's operator-facing name.

float $observed

The latest observation.

float $baseline

The median of the observations before it.

float $deviations

How far the observation sits from the baseline, signed.

int $samples

How many earlier observations the baseline came from.

string $unit

What the numbers are counted in, for rendering.

Returns

mixed —

direction()

direction() : string

Which direction the measurement moved.

Returns

string —

Either "above" or "below".

severity()

severity() : int

How severe this departure is.

A departure is a symptom and never a fault on its own, so it tops out at ERROR: a site that doubled its traffic is not corrupt, and a detector that could raise CRITICAL would put the repair ladder straight onto the quarantine rung for a busy Tuesday.

Returns

int —

INFO, WARN or ERROR.

toFinding()

toFinding() : \Drupal\strata\Health\Finding

The finding this anomaly is recorded as.

Returns

\Drupal\strata\Health\Finding —

The finding, scoped to the metric so the ledger tracks each measurement separately.

describe()

describe() : string

A sentence an operator can act on.

Returns

string —

What moved, by how much, against what.

jsonSerialize()

jsonSerialize() : array

{@inheritdoc}

Returns

array —

render()

render(float  $value) : string

Renders a measurement without trailing noise.

Parameters

float $value

The value.

Returns

string —

The value, as an integer when it is one.