Files
bvandeusenandClaude Opus 5.5 5569f9934e
CI / lint (push) Successful in 2s
CI / integration (push) Failing after 1m24s
CI / unit (push) Successful in 1m37s
CI / publish (push) Skipped
feat(anomalies): a metric out of its normal is an anomaly to review (#5740)
#5740 "A metric that departs from its normal is recorded as an anomaly to
review, and is findable after it ends", milestone 513.

- Every minute each learned key's last 15 minutes is judged against its
  hour's normal: above the usual hold x1.25 and by the metric's floor opens
  an occurrence, which ends when the level comes back.
- metric_anomalies holds one row per item to review; a repeat while it
  still waits joins it as an occurrence (metric_anomaly_spans).
- An ended row nobody reviews within anomalies.review_days (14, Settings ->
  Thresholds) lapses; an ongoing one never does.
- Learning skips every hour an occurrence covers unless its anomaly was
  marked normal: no normal is learned without review.
- Alerts -> Anomalies lists those to review first, then the reviewed and
  lapsed under day dividers; marking is operator/admin and audited.
- The Overview widget and get_overview warn of open ones and count those
  to review; the host page shows its own; the weekly report lists the
  week's and the lapsed; MCP list_anomalies and review_anomaly.
- Reviewed and lapsed rows are pruned at data.retention_days, and kept
  in backups like alert history.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 13:41:57 -04:00

37 lines
1.7 KiB
HTML

{% extends "base.html" %}
{% from "_macros.html" import crumbs, page_header %}
{% from "_anomaly.html" import anomaly_row with context %}
{% block title %}Metric Anomalies — Steward{% endblock %}
{% block breadcrumb %}{{ crumbs([("Alerts", "/alerts/"), ("Anomalies", "")]) }}{% endblock %}
{% block content %}
{% call page_header("Metric anomalies", "A metric that left what is normal for it at that hour. Mark each normal, so its hours are learned, or a real problem, so they are not.") %}
<a class="btn btn-ghost" href="/alerts/history">History</a>
{% endcall %}
{% macro divided(items) %}
{% for item in items %}
{% if item.opens_group %}<h3 class="table-divider" style="font-size:0.78rem;font-weight:500;color:var(--text);background:var(--bg-elevated);padding:0.35rem 0.75rem;margin:0.75rem -0.75rem 0;border-top:1px solid var(--border-mid);border-bottom:1px solid var(--border-mid);">{{ item.group }}</h3>{% endif %}
{{ anomaly_row(item.v, back="/alerts/anomalies") }}
{% endfor %}
{% endmacro %}
<div class="card" style="margin-top:1rem;">
<h2 class="section-title" style="margin-bottom:0.35rem;">
{% if to_review %}{{ to_review|length }} to review{% else %}Nothing to review{% endif %}
</h2>
<p style="font-size:0.8rem;color:var(--text-muted);margin:0;">
An ended anomaly nobody reviews within {{ review_days }} day{{ "s" if review_days != 1 }} lapses:
it leaves this list, stays below as not reviewed, and is never learned.
The window is in Settings → Thresholds.
</p>
{{ divided(to_review) }}
</div>
{% if past %}
<div class="card" style="margin-top:1rem;">
<h2 class="section-title" style="margin-bottom:0.35rem;">Reviewed and lapsed</h2>
{{ divided(past) }}
</div>
{% endif %}
{% endblock %}