> ## Documentation Index
> Fetch the complete documentation index at: https://docs.molesignal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 值班负担

> 统计每个人值了多久的班、收到几次告警通知，其中几次在夜里或周末，被吵醒了几个晚上。

```http theme={null}
GET /api/v1/alerts/insights/oncall-load
```

统计一段时间里每个人的值班负担，通知多的在前。该调用需要 `alerts.incidents.read`。

通知是送到人手上的告警触发和升级通知，每人每个通知算一次，发送失败的不算。夜里是本地 22:00 到次日 08:00，周末是本地周六和周日；本地时间按这个人所在排班的时区，不在任何排班里的按其[免打扰时段](https://docs.molesignal.com/zh-Hans/account.md#通知设置)的时区，再没有就按 UTC。凌晨的通知算前一个晚上。

**查询参数**

| 参数 | 类型 | 说明 |
| - | - | - |
| `window_secs` | integer | 往回看多少秒。默认 `2592000`（30 天），取值限制在 1 天到 90 天之间。 |
| `schedule_id` | string | 只算这个排班的成员和班次。 |

```bash cURL theme={null}
curl "http://localhost:5080/api/v1/alerts/insights/oncall-load?window_secs=604800" \
  -H "authorization: Bearer $MS_TOKEN"
```

```json 200 theme={null}
{
  "window_secs": 604800,
  "night_start_hour": 22,
  "night_end_hour": 8,
  "people": [
    {
      "user_id": "<user-id>",
      "oncall_secs": 302400,
      "pages": 9,
      "night_pages": 3,
      "weekend_pages": 2,
      "interrupted_nights": 2,
      "timezone": "Asia/Shanghai",
      "responded": 6,
      "mtta_secs": 214.0
    }
  ]
}
```

**响应**

| 字段 | 说明 |
| - | - |
| `window_secs` | 限制范围之后的窗口。 |
| `night_start_hour`、`night_end_hour` | 夜里从几点到几点。 |
| `people[].oncall_secs` | 这段时间在排班上值班的秒数，替班和换班都算在内。 |
| `people[].pages` | 收到的告警通知次数。 |
| `people[].night_pages`、`people[].weekend_pages` | 其中在夜里、在周末的次数。 |
| `people[].interrupted_nights` | 夜里收到过通知的晚上数。 |
| `people[].timezone` | 判断夜里和周末用的时区。 |
| `people[].responded`、`people[].mtta_secs` | 这段时间这个人第一个接手的事件数，以及从触发到接手的平均秒数。接手的算法同[事件洞察](https://docs.molesignal.com/zh-Hans/api/alerting/insights.md)。 |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.