Ir al contenido
Documentation

Guide — MongoStat anomaly detection + AI Root Cause Walk

How the live MongoStat tab spots saturation, spikes, and pile-ups — and how the IncidentDrawer turns each one into a 3-stop Root Cause Walk.

Estimated time: ~8 minutes
In this guide

Introduction

Open the MongoStat tab and NoSqlStudio polls serverStatus() every 1.5 s. The sparklines you already know are now backed by an anomaly detector that scans the rolling ring buffer on every render. When something abnormal sustains for two ticks, it surfaces as a red banner at the top + a row in the Detected anomalies grid + a clickable button that opens the IncidentDrawer for AI-assisted root-cause analysis.

Concept

Why this matters

The chart used to be passive — you had to read it. Now it talks back: the detector flags 5 classes of trouble and the AI explains the most likely cause in a 3-stop walk, in your locale. Same stream, way less squinting.

How to read this guide

Each of the 5 anomalies has the same shape: what triggers it, what the drawer shows, what the action button does. The action button never blasts a change — it always opens the drawer for non-kill cases, and asks confirmation for the kill case.

Anomaly 1

connection-saturation

Fires when current / max connections crosses 0.75 sustained for two ticks. Severity goes medium → high at 0.90.

Step

Trigger

connections.current / (current + available) ≥ 0.75 on two consecutive samples.

Heads-up

Atlas free tier (M0/M2/M5)

Shared-tier clusters don't expose wiredTiger.cache.maximum bytes configured. We treat the absence as a free-tier signal *only after 30 ticks of evidence and only on \.mongodb.net hosts** — to stop dedicated clusters from being flagged with a fake ~500 cap during the first wt-less seconds.

Step

Drawer payload

Context section lists current/max/available, the surrounding ops/s rates, and any structured incident metadata. AI section runs the 3-stop walk (What / Why / How). Actions offers "Show top connections" which drills into currentOp grouped by app.

Anomaly 2

opcounter-spike

Fires when any opcounter (inserts/query/update/delete/getmore/command) crosses μ + 3σ of its 5-minute rolling mean AND is > 1.5× μ, sustained two ticks.

Step

Trigger

Floor of 5 ops/s. The detector emits one row per spike — the first counter that crosses, not six near-identical ones.

Step

Drawer payload

Counter name + spike ratio + baseline μ are surfaced as deterministic context. Action: "Show top ops" filters currentOp by the offending verb.

Anomaly 3

netout-surge

Fires when netOutKB exceeds 3× rolling mean AND the query rate is NOT proportionally up — the classic signature of an unindexed scan returning huge payloads.

Step

Trigger

Quiet floor of 32 KB/s rolling mean (we ignore idle servers). Sustained two ticks, with netRatio > queryRatio × 1.5.

Step

Drawer payload

MB/s + netOut:query ratio in the context. Action: "Find slow queries" links to the Profiler workspace.

Anomaly 4

currentop-pileup

Fires when ≥ 5 ops have elapsed > 1 s simultaneously, sustained two ticks. Requires Capture Ops to be enabled in the toolbar.

Step

Capture Ops gating

Concept

Dormant when Capture Ops is off

The grid shows a 💡 hint when it is — to remind you the rule is sitting silent, not broken.

Step

Action — Kill

Heads-up

Two-step kill

The grid's Kill long-running → button asks for confirmation, then opens the long-running list. Each individual killOp inside the list also prompts again. Two prompts, no surprises.

Anomaly 5

replication-lag

Only relevant on replica sets. The poller calls replSetGetStatus() every 30 s and derives max(primaryOptime − secondaryOptime). Fires at > 5 s, severity high above 60 s.

Step

Trigger

Managed clusters that reject replSetGetStatus silently disable this rule — no spammy errors.

Step

Action — Open RS Status

Dispatches compass:mongostat:open-rs-status so the host can deep-link into the RS Status workspace. Falls back to the connection drilldown when no listener is wired.

Muting false positives

ETL jobs and scheduled batch loads sometimes look like spikes. Every anomaly row has an button (and the drawer has an "Ignore this incident" button). Clicking it persists the signature (kind + scope + 5-min bucket + severity) to localStorage — so the next time the same pattern hits, the detector skips it for you.

Want to un-mute? Clear compass:mongostat:dismissed-signatures in DevTools, or use the upcoming Settings panel.

Summary

AnomalyTriggerSeverity bumps to high atAction button
connection-saturationcurrent/max ≥ 0.75 × 2 ticksratio ≥ 0.90Show top connections
opcounter-spikeany counter > μ + 3σ × 2 ticksratio > 6× μShow top ops
netout-surgenetOut > 3× μ, query rate flat × 2 ticksnetRatio > 6×Find slow queries
currentop-pileup≥ 5 ops > 1s × 2 ticks (Capture Ops on)≥ 20 long opsKill long-running (confirm)
replication-lagprimary→secondary lag > 5 s × 2 tickslag > 60 sOpen RS Status
AI Root Cause responses are cached for 4 hours per signature + provider + locale, so re-opening the same drawer doesn't burn fresh tokens. Provider picker + cost hint stay visible at the top of the AI section.