AlertService class
告警服务 / Alert service
在数据写入(网络/日志/内存/FPS)时被调用以检测是否命中规则。 命中的告警以 AlertEvent 形式入队,并通过 unreadCount 暴露未读数, 供悬浮球显示红点。告警列表有上限(环形缓冲),避免无限增长。 Invoked on data write to detect rule hits. Hit events are queued and exposed via unreadCount for the floating button red dot. Bounded ring buffer.
Properties
-
events
→ UnmodifiableListView<
AlertEvent> -
告警事件只读视图(最新在前)/ Read-only event view (newest first)
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
rules
→ UnmodifiableListView<
AlertRule> -
规则列表只读视图 / Read-only rule list
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
unreadCount
→ ValueNotifier<
int> -
未读告警数(供红点)/ Unread alert count (for red dot)
final
Methods
-
addRule(
AlertRule rule) → void - 新增一条规则 / Add a rule
-
checkFps(
double fps) → void - 检测 FPS / Check FPS
-
checkLog(
LogEntry e) → void - 检测日志是否命中规则 / Check a log entry against rules
-
checkMemory(
double mb) → void - 检测内存占用(MB)/ Check memory usage in MB
-
checkNetwork(
NetworkRequest r) → void - 检测网络请求是否命中规则 / Check a network request against rules
-
clearAll(
) → void - 清空全部告警 / Clear all alerts
-
clearUnread(
) → void - 清空未读 / Clear unread
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeRule(
String id) → void - 移除规则 / Remove a rule
-
restore(
Iterable< AlertEvent> records) → void - 恢复持久化的告警事件(跨重启不丢)。 Restore persisted alert events (survives restarts).
-
setRules(
List< AlertRule> rules) → void - 获取/设置规则 / Get/set rules
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → AlertService
-
单例实例 / Singleton instance
final