feat: 注册 Prometheus 指标与 Handler
This commit is contained in:
@@ -221,6 +221,22 @@
|
||||
- 备选方案:StdEncoding 带 padding。
|
||||
- 影响:SDK/文档示例需无 `=` 结尾。
|
||||
|
||||
### P4 2026-09-30
|
||||
|
||||
1. **指标包放在 `internal/metrics`**
|
||||
- 原条款:TASKS 分工表未列 metrics 目录;P4 要求用 prometheus/client_golang 建注册表。
|
||||
- 实际做法:新建 `internal/metrics`,提供 `New`/`Handler`/`Registry` 字段供各线打点;不在 `serve` 挂路由(访问规则属 A 线)。
|
||||
- 原因:不宜塞进 auth/store/config。
|
||||
- 备选方案:放 `internal/httpx`(A 线目录)。
|
||||
- 影响:A/N 接线时 import 本包并挂 `/metrics`。
|
||||
|
||||
2. **指标命名**
|
||||
- 原条款:列了指标含义,未规定 Prometheus 名字。
|
||||
- 实际做法:`nixmsg_connections{transport}`、`nixmsg_endpoints`、`nixmsg_deliveries_pending`、`nixmsg_messages_scheduled`、`nixmsg_dispatch_to_push_duration_seconds`、`nixmsg_ack_duration_seconds`、`nixmsg_write_queue_length`、`nixmsg_write_batch_commit_duration_seconds`、`nixmsg_password_hash_queue_length`、`nixmsg_errors_total{code}`。
|
||||
- 原因:固定可抓取文本便于联调。
|
||||
- 备选方案:更短前缀或 HistogramVec。
|
||||
- 影响:仪表盘按上述名字配置。
|
||||
|
||||
## 连接 N
|
||||
|
||||
暂无。
|
||||
|
||||
Reference in New Issue
Block a user