NetworkMonitorDetector class

Detects slow, excessive, or oversized HTTP requests.

Receives RequestRecords from the SleuthHttpOverrides monitoring proxy and evaluates three issue types:

  • Slow Request: response time exceeds threshold
  • Frequency Spike: too many requests in a 5-second window
  • Large Response: response body exceeds size threshold

Uses a ring buffer of records with buffer-derived issue lifecycle: issues are cleared and rebuilt from current buffer state on each new record and on each frequency timer tick. The buffer is cleared on route transitions via clearRecords, so issues from a previous page don't persist on the new page.

Inheritance
Mixed-in types

Constructors

NetworkMonitorDetector({int slowThresholdMs = 1000, int criticalSlowThresholdMs = 3000, int frequencyLimit = 30, int largeResponseBytes = 1048576, DateTime clock()?})

Properties

criticalSlowThresholdMs → int
Slow request critical threshold in milliseconds. Default 3000 ms.
final
description → String
Short description of what this detector checks.
finalinherited
frequencyLimit → int
Maximum requests per 5-second window. Default 30.
final
hashCode → int
The hash code for this object.
no setterinherited
highlights → List<WidgetHighlight>
Highlight candidates collected during the last scan. Empty for detectors that don't produce visual highlights.
no setterinherited
isEnabled ↔ bool
Whether this detector is currently active.
getter/setter pairoverride
issues → List<PerformanceIssue>
Current list of detected issues. Reset each analysis cycle.
no setteroverride
key → String?
Stable identifier for config-driven gating of custom detectors.
finalinherited
largeResponseBytes → int
Large response threshold in bytes. Default 1MB.
final
lastObservedPeakCount → int
Detector-measured peak count from the most recent _evaluateFrequency call. Capture-mode operators export this for sub-threshold legs where no warning event fires.
no setter
lifecycle → DetectorLifecycle
Lifecycle classification determining data source requirements.
finalinherited
name → String
Human-readable name of this detector (e.g., "Frame Timing").
finalinherited
records → List<RequestRecord>
Unmodifiable view of the ring buffer for session export.
no setter
requiresTreeScan → bool
Whether this detector scans the widget/render tree.
no setterinherited
requiresVm → bool
Whether this detector needs VM service data to function. DetectorLifecycle.runtime detectors benefit from VM data but don't require it.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
slowThresholdMs → int
Slow request warning threshold in milliseconds. Default 1000 ms.
final
type → DetectorType
The detector type identifier used for configuration.
finalinherited
validationMetadata → DetectorMetadata
Metadata for this detector. Must be non-null on shipping detectors — the audit test gates this.
no setteroverride
vmConnected ← bool
Update VM connectivity state.
no getterinherited

Methods

afterElement(Element element) → void
Called after an element's children have all been visited.
inherited
checkElement(Element element) → void
Check a single element during the unified tree walk.
inherited
clearRecords() → void
Clear all buffered records and issues.
dispose() → void
Dispose of any resources held by this detector.
override
endRequest(int requestId) → void
Called when an HTTP request completes or fails.
evaluateNow() → void
Triggers issue evaluation using whatever data has been staged.
inherited
finalizeScan() → void
Finalise the scan: process accumulated data and create issues.
inherited
flushFrequencyEvaluation() → void
Recomputes lastObservedPeakCount without emitting any request_frequency issue. Capture screens call this before reading the peak getter so the operator's export pathway is decoupled from the periodic _frequencyTimer phase. Idempotent — repeated calls with the same buffer yield the same peak value and do NOT append duplicate issues to _issues (issue emission is owned by _evaluateFrequency, which only runs from the scan pipeline's _evaluate wrapper that clears _issues first).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyWalkCompleted() → void
Called when the tree walk completed without exceptions.
inherited
pendingRequestSnapshot() → (int, int?)
Snapshot of pending requests at this instant. Returns (0, null) when no requests are in-flight.
prepareScan(BuildContext context) → void
Prepare for a new scan cycle. Called once before the unified tree walk.
inherited
processFrame(FrameStats frame) → void
Process one presented frame from FrameTiming.
inherited
processRecord(RequestRecord record) → void
Process a completed (or failed) HTTP request.
processTimelineData(ParsedTimelineData data) → void
Process VM timeline data.
inherited
scanTree(BuildContext context) → void
Scan the widget/render tree for issues.
inherited
startRequest(int requestId, DateTime startedAt) → void
Called when an HTTP request starts (before response).
toString() → String
A string representation of this object.
inherited
updateDebugSnapshot(DebugSnapshot snapshot) → void
Called with debug callback data when available.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited