feat(ops): 添加生产监控告警基线

- 新增 Prometheus/Grafana/Loki/Promtail 监控 profile\n- 覆盖 DB、磁盘、慢 API、慢 Prisma、任务失败和小宝摘要 stale 告警\n- 补充 postgres-exporter 自定义查询、Dashboard、部署文档和校验\n\nCo-Authored-By: GPT-5 Codex <codex@openai.com>
This commit is contained in:
2026-07-08 16:21:07 +08:00
parent eef09d5af4
commit 7837a809ca
15 changed files with 587 additions and 1 deletions

View File

@@ -0,0 +1,78 @@
{
"uid": "ftb-production-overview",
"title": "FTB Production Overview",
"schemaVersion": 39,
"version": 1,
"refresh": "30s",
"tags": ["ftb", "production", "v2.8"],
"time": {
"from": "now-6h",
"to": "now"
},
"panels": [
{
"id": 1,
"type": "stat",
"title": "DB Availability",
"gridPos": { "x": 0, "y": 0, "w": 6, "h": 4 },
"targets": [
{ "datasource": { "type": "prometheus", "uid": "Prometheus" }, "expr": "pg_up", "refId": "A" }
]
},
{
"id": 2,
"type": "timeseries",
"title": "Slow API Logs",
"gridPos": { "x": 6, "y": 0, "w": 6, "h": 4 },
"targets": [
{ "datasource": { "type": "prometheus", "uid": "Prometheus" }, "expr": "increase(ftb_slow_api_log_total[10m])", "refId": "A" }
]
},
{
"id": 3,
"type": "timeseries",
"title": "Slow Prisma Logs",
"gridPos": { "x": 12, "y": 0, "w": 6, "h": 4 },
"targets": [
{ "datasource": { "type": "prometheus", "uid": "Prometheus" }, "expr": "increase(ftb_slow_prisma_log_total[10m])", "refId": "A" }
]
},
{
"id": 4,
"type": "stat",
"title": "Xiaobao Stale Summaries",
"gridPos": { "x": 18, "y": 0, "w": 6, "h": 4 },
"targets": [
{ "datasource": { "type": "prometheus", "uid": "Prometheus" }, "expr": "ftb_xiaobao_stale_summary_count", "refId": "A" }
]
},
{
"id": 5,
"type": "timeseries",
"title": "Job Failure Logs",
"gridPos": { "x": 0, "y": 4, "w": 8, "h": 5 },
"targets": [
{ "datasource": { "type": "prometheus", "uid": "Prometheus" }, "expr": "increase(ftb_job_failure_log_total[10m])", "refId": "A" }
]
},
{
"id": 6,
"type": "stat",
"title": "Root Disk Free %",
"gridPos": { "x": 8, "y": 4, "w": 8, "h": 5 },
"targets": [
{ "datasource": { "type": "prometheus", "uid": "Prometheus" }, "expr": "100 * node_filesystem_avail_bytes{mountpoint=\"/\",fstype!~\"tmpfs|overlay\"} / node_filesystem_size_bytes{mountpoint=\"/\",fstype!~\"tmpfs|overlay\"}", "refId": "A" }
]
},
{
"id": 7,
"type": "logs",
"title": "Server Warning/Error Logs",
"gridPos": { "x": 16, "y": 4, "w": 8, "h": 5 },
"targets": [
{ "datasource": { "type": "loki", "uid": "Loki" }, "expr": "{compose_service=\"server\"} |~ \"warn|error|失败|Slow\"", "refId": "A" }
]
}
]
}

View File

@@ -0,0 +1,12 @@
apiVersion: 1
providers:
- name: FTB Production
orgId: 1
folder: FTB
type: file
disableDeletion: false
updateIntervalSeconds: 30
options:
path: /var/lib/grafana/dashboards

View File

@@ -0,0 +1,16 @@
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
access: proxy
url: http://prometheus:9090
isDefault: true
editable: false
- name: Loki
type: loki
access: proxy
url: http://loki:3100
editable: false