stormlog.infer.diagnosis_signals

Cheap signals that decide whether a window of scrapes looks like an incident.

evaluate_signal is a pure function over one window of /metrics scrapes the caller chose. It returns the kind’s value, whether the window had enough data to decide, and the verdict against the shared threshold table. It never diagnoses: a value over its threshold says a mechanism is suspected in an engine’s aggregate metrics, which cover every client’s traffic. Confirming it, and saying whose requests it hurt, is the diagnoser’s job.

Only kinds that /metrics alone can decide are evaluated; every other kind answers requires_hook, requires_trace or requires_client.

Functions

evaluate_signal(kind, scrapes[, config])

Evaluate kind over a window of consecutive scrapes, in time order.

Classes

SignalConfig([engine, min_scrapes, ...])

How to evaluate one window.

SignalValue(value, sufficient, reason, ...)

One kind's value over a window, and the verdict against its threshold.

class stormlog.infer.diagnosis_signals.SignalConfig(engine=None, min_scrapes=2, thresholds=<factory>, reference=None)[source]

Bases: object

How to evaluate one window.

thresholds overrides entries of the shared table by key; a result says when it did. A key the table lacks, or a value that is not a finite number (a NaN, a string, a bool), is refused: a NaN would never be exceeded and a misspelt key never read, both silently. min_scrapes must be at least 2. reference is the prefix-cache hit ratio a window is compared with, which only the caller can know.

Parameters:
  • engine (str | None)

  • min_scrapes (int)

  • thresholds (Mapping[str, float])

  • reference (float | None)

engine: str | None = None
min_scrapes: int = 2
thresholds: Mapping[str, float]
reference: float | None = None
class stormlog.infer.diagnosis_signals.SignalValue(value, sufficient, reason, exceeds, threshold, thresholds_version, threshold_overridden, detail)[source]

Bases: object

One kind’s value over a window, and the verdict against its threshold.

exceeds is None whenever sufficient is False; reason is then the first of the reasons listed in detail["reasons"].

Parameters:
  • value (float | None)

  • sufficient (bool)

  • reason (str | None)

  • exceeds (bool | None)

  • threshold (float | None)

  • thresholds_version (str)

  • threshold_overridden (bool)

  • detail (Mapping[str, Any])

value: float | None
sufficient: bool
reason: str | None
exceeds: bool | None
threshold: float | None
thresholds_version: str
threshold_overridden: bool
detail: Mapping[str, Any]
stormlog.infer.diagnosis_signals.evaluate_signal(kind, scrapes, config=None)[source]

Evaluate kind over a window of consecutive scrapes, in time order.

Raises:

ValueError – for a kind outside the closed vocabulary.

Parameters:
Return type:

SignalValue