refactor: 将 memory checker 重命名为 mem
- 类型标识符 memory → mem - 类名 MemoryChecker → MemChecker - 内部类型名统一 Memory* → Mem* - 内部函数名统一 *Memory* → *Mem* - 目录重命名 memory/ → mem/(源码、测试、文档) - 配置键 memory: → mem: - 重新生成 probe-config.schema.json - 保留中文"内存"用户提示 破坏性变更:无向后兼容
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
# Memory Checker
|
||||
# Mem Checker
|
||||
|
||||
`type: memory` 用于检查本机系统级内存使用状况,包括物理内存和交换空间的使用率及字节数。
|
||||
`type: mem` 用于检查本机系统级内存使用状况,包括物理内存和交换空间的使用率及字节数。
|
||||
|
||||
## 配置项
|
||||
|
||||
Memory checker 配置为空对象,无需额外参数:
|
||||
Mem checker 配置为空对象,无需额外参数:
|
||||
|
||||
```yaml
|
||||
memory: {}
|
||||
mem: {}
|
||||
```
|
||||
|
||||
## expect 校验项
|
||||
@@ -54,10 +54,10 @@ memory: {}
|
||||
```yaml
|
||||
- id: "local-memory"
|
||||
name: "本机内存"
|
||||
type: memory
|
||||
type: mem
|
||||
interval: "30s"
|
||||
timeout: "5s"
|
||||
memory: {}
|
||||
mem: {}
|
||||
expect:
|
||||
usagePercent:
|
||||
lte: 85
|
||||
@@ -68,8 +68,8 @@ memory: {}
|
||||
```yaml
|
||||
- id: "local-memory-available"
|
||||
name: "可用内存检查"
|
||||
type: memory
|
||||
memory: {}
|
||||
type: mem
|
||||
mem: {}
|
||||
expect:
|
||||
availableBytes:
|
||||
gte: "4GB"
|
||||
@@ -80,8 +80,8 @@ memory: {}
|
||||
```yaml
|
||||
- id: "local-memory-swap"
|
||||
name: "内存和交换空间"
|
||||
type: memory
|
||||
memory: {}
|
||||
type: mem
|
||||
mem: {}
|
||||
expect:
|
||||
usagePercent:
|
||||
lte: 80
|
||||
@@ -91,14 +91,14 @@ memory: {}
|
||||
|
||||
## 语义说明
|
||||
|
||||
Memory checker 通过 `systeminformation` 库读取系统内存数据,在 Linux、macOS 和 Windows 上均可运行。
|
||||
Mem checker 通过 `systeminformation` 库读取系统内存数据,在 Linux、macOS 和 Windows 上均可运行。
|
||||
|
||||
- **`usagePercent`** 使用 `activeBytes / totalBytes` 计算,反映真实的内存压力,不受 Linux buffers/cache 缓存影响。推荐使用此字段进行内存健康检查。
|
||||
- **`usedPercent`** 使用 `usedBytes / totalBytes` 计算,包含 buffers/cache。在 Linux 上此值通常高于 `usagePercent`。
|
||||
- **Swap 字段**:当系统未配置交换分区时,`swapTotalBytes` 为 `0`,`swapUsagePercent` 为 `null`(非 `0`)。
|
||||
- **`buffcacheBytes`**:反映 Linux 的 buffers + cache 用量,在其他平台上可能为 `null`。
|
||||
|
||||
Memory checker 是即时读取(非采样),无需 `sampleDuration`,执行速度远快于 CPU checker。虽然读取本身很快,但仍受 target `timeout` 约束——若底层系统调用悬挂或阻塞超过 `timeout`,checker 会返回 `memory/timeout` failure。
|
||||
Mem checker 是即时读取(非采样),无需 `sampleDuration`,执行速度远快于 CPU checker。虽然读取本身很快,但仍受 target `timeout` 约束——若底层系统调用悬挂或阻塞超过 `timeout`,checker 会返回 `mem/timeout` failure。
|
||||
|
||||
## 跨平台注意事项
|
||||
|
||||
@@ -116,4 +116,4 @@ Memory checker 是即时读取(非采样),无需 `sampleDuration`,执行
|
||||
|
||||
## 更新触发条件
|
||||
|
||||
修改 Memory checker 配置、expect 字段、行为或语义时,必须更新本文档。
|
||||
修改 Mem checker 配置、expect 字段、行为或语义时,必须更新本文档。
|
||||
Reference in New Issue
Block a user