> ## 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/discovery/findings
GET /api/v1/alerts/discovery/findings/{id}
```

列出[自动发现](https://docs.molesignal.com/zh-Hans/alerting/discovery.md)找到的问题，最近看到的在前，或读一条发现。需要 `alerts.discovery.read`。

**查询参数**

| 参数 | 说明 |
| - | - |
| `status` | `open`（默认）、`ended` 或 `all`。 |
| `kind` | `apm_anomaly`、`apm_regression`、`rum_new_issue` 或 `rum_regressed_issue`。 |
| `limit` | 默认 100，最多 500。 |

**发现的字段**

| 字段 | 说明 |
| - | - |
| `kind` | 种类，同上。 |
| `key` | 认出同一个问题用的：种类、对象和指标拼成。 |
| `severity` | `warning`、`error` 或 `critical`。 |
| `subject` | APM 服务（`命名空间/服务名`）或 RUM 应用 id。 |
| `environment`、`metric` | 环境；APM 突变的指标：`error_rate`、`p95`（微秒）或 `throughput`（每秒请求数）。 |
| `title` | 一句话说明。 |
| `value`、`baseline` | 现在的值和拿来比的值。 |
| `started_at`、`last_seen_at`、`ended_at` | 开始、最近一次看到和结束的时刻（微秒）；`ended_at` 为空表示进行中。 |
| `missed_rounds` | 连续几轮没看到；到 3 轮就结束。 |
| `detail` | APM 的发现有 `previous`、`last_week`、`version`、`previous_version` 和附近的变更 `changes`；RUM 的有 `issue_id`、`application`、`error_type`、`location`、`version`。 |

```bash cURL theme={null}
curl "http://localhost:5080/api/v1/alerts/discovery/findings?status=open" \
  -H "authorization: Bearer $MS_TOKEN"
```

```json 200 theme={null}
[
  {
    "id": "3KF0Yb6n1VxP8a2Qm7Ld4Rs9Tu1",
    "org_id": "<organization-id>",
    "kind": "apm_anomaly",
    "key": "apm_anomaly|default/checkout|production|error_rate",
    "severity": "critical",
    "subject": "default/checkout",
    "environment": "production",
    "metric": "error_rate",
    "title": "Error rate of checkout moved",
    "value": 0.12,
    "baseline": 0.004,
    "started_at": 1790000000000000,
    "last_seen_at": 1790002400000000,
    "ended_at": null,
    "missed_rounds": 0,
    "detail": {"previous": 0.004, "last_week": 0.005, "changes": []},
    "created_at": 1790000300000000,
    "updated_at": 1790002400000000
  }
]
```

要把发现变成事件，用[创建规则](https://docs.molesignal.com/zh-Hans/api/alerting/create-rule.md)建一条 `query.discovery` 规则：`{"kinds": [...], "subjects": [...], "environments": [...], "min_severity": "warning"}`，都不给就是全部。保存时规则统一成固定的形状：按发现拆分，每条命中的发现各开一个事件，严重度就是发现的严重度，没设 `trigger.urgency` 时按低紧急度。


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