lili 47644881ff
Some checks failed
contract-gates / contract-gates (push) Has been cancelled
docs-gate / docs-gate (push) Has been cancelled
feat(observability): Grafana 看板激活生成指标 + 三条阈值告警(阶段四·面五之上)
- observability-overview.json:业务指标占位 panel 改用面五真实指标名(gen_task_total{status=succeeded}
  / gen_duration_seconds / gen_queue_depth / gen_gate_fail_total,去掉猜错的 huijing_ 前缀与 success 标签)
  + 新增 llm_cost 成本 panel(单次均值/近1h累计,标自估值非 new-api 权威)。
- provisioning/alerting/gen-alerts.yaml:三阈值告警——生成成功率<80%(MVP门 §2)/ 队列深度>15(便宜档
  并发上限)/ game-cloud up=0(后端不可达),+ webhook contact point(飞书/钉钉,URL 待创始人填)+ 路由策略。

对着 MVP 门(成功率≥80% / 可用性≥99.5% / 便宜档并发≤15)。webhook URL 未填前告警在 Grafana UI 可见但不
外发,§7 验收#2「告警真送达」待真 webhook。compose 已挂 provisioning 全目录,重启 grafana 容器即生效。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-05 20:47:52 -07:00

121 lines
5.9 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"annotations": { "list": [] },
"editable": true,
"graphTooltip": 1,
"time": { "from": "now-6h", "to": "now" },
"refresh": "30s",
"schemaVersion": 39,
"tags": ["huijing", "observability"],
"title": "绘境AI · 可观测总览",
"uid": "huijing-obs-overview",
"templating": { "list": [] },
"panels": [
{
"type": "row",
"title": "观测栈自监控(Collector · 起栈即有数据)",
"gridPos": { "h": 1, "w": 24, "x": 0, "y": 0 },
"collapsed": false,
"panels": []
},
{
"type": "timeseries",
"title": "Collector 接收信号速率(spans/logs/metrics per s)",
"description": "OTLP 入口吞吐。三条生成/服务路推来的信号量。",
"datasource": { "type": "prometheus", "uid": "prometheus" },
"gridPos": { "h": 8, "w": 12, "x": 0, "y": 1 },
"fieldConfig": { "defaults": { "unit": "reqps" }, "overrides": [] },
"targets": [
{ "refId": "A", "expr": "sum(rate(otelcol_receiver_accepted_spans_total[5m]))", "legendFormat": "spans" },
{ "refId": "B", "expr": "sum(rate(otelcol_receiver_accepted_log_records_total[5m]))", "legendFormat": "logs" },
{ "refId": "C", "expr": "sum(rate(otelcol_receiver_accepted_metric_points_total[5m]))", "legendFormat": "metrics" }
]
},
{
"type": "timeseries",
"title": "Collector 导出成功/失败 + 队列(丢弃即后端不可达)",
"description": "验收第 6 条要看的 queue/drop 指标。send_failed 持续 > 0 说明后端抖动或不可达。",
"datasource": { "type": "prometheus", "uid": "prometheus" },
"gridPos": { "h": 8, "w": 12, "x": 12, "y": 1 },
"fieldConfig": { "defaults": {}, "overrides": [] },
"targets": [
{ "refId": "A", "expr": "sum(rate(otelcol_exporter_sent_spans_total[5m]))", "legendFormat": "sent spans/s" },
{ "refId": "B", "expr": "sum(rate(otelcol_exporter_send_failed_spans_total[5m]))", "legendFormat": "failed spans/s" },
{ "refId": "C", "expr": "sum(otelcol_exporter_queue_size)", "legendFormat": "queue size" }
]
},
{
"type": "stat",
"title": "被监控目标存活(Prometheus up)",
"description": "每个 scrape target 的 up/down。后续波接入 game-cloud/nacos/rmq 后这里会长出更多目标。",
"datasource": { "type": "prometheus", "uid": "prometheus" },
"gridPos": { "h": 6, "w": 12, "x": 0, "y": 9 },
"fieldConfig": {
"defaults": {
"mappings": [
{ "type": "value", "options": { "0": { "text": "DOWN", "color": "red" }, "1": { "text": "UP", "color": "green" } } }
]
},
"overrides": []
},
"options": { "colorMode": "background", "textMode": "value_and_name" },
"targets": [
{ "refId": "A", "expr": "up", "legendFormat": "{{job}}", "instant": true }
]
},
{
"type": "row",
"title": "生成业务指标(面五 GenMetrics · 已生效 · 需 huijing.aigc.metrics.enabled=true)",
"gridPos": { "h": 1, "w": 24, "x": 0, "y": 15 },
"collapsed": false,
"panels": []
},
{
"type": "timeseries",
"title": "生成成功率(按状态)",
"description": "面五 GenMetrics:任务终态回填处埋 gen_task_total{status=succeeded/failed/timed_out}(§6)。成功率 = succeeded / 全部;需有终态任务才有数据。",
"datasource": { "type": "prometheus", "uid": "prometheus" },
"gridPos": { "h": 8, "w": 8, "x": 0, "y": 16 },
"fieldConfig": { "defaults": { "unit": "percentunit" }, "overrides": [] },
"targets": [
{ "refId": "A", "expr": "sum(rate(gen_task_total{status=\"succeeded\"}[30m])) / clamp_min(sum(rate(gen_task_total[30m])), 1)", "legendFormat": "成功率" }
]
},
{
"type": "timeseries",
"title": "生成耗时 P50/P95",
"description": "面五 GenMetrics:gen_duration_seconds histogram(源 worker trace.wallS,§6)。便宜档需续修的 gen 延迟可达 20min,盯 P95。",
"datasource": { "type": "prometheus", "uid": "prometheus" },
"gridPos": { "h": 8, "w": 8, "x": 8, "y": 16 },
"fieldConfig": { "defaults": { "unit": "s" }, "overrides": [] },
"targets": [
{ "refId": "A", "expr": "histogram_quantile(0.50, sum(rate(gen_duration_seconds_bucket[5m])) by (le))", "legendFormat": "P50" },
{ "refId": "B", "expr": "histogram_quantile(0.95, sum(rate(gen_duration_seconds_bucket[5m])) by (le))", "legendFormat": "P95" }
]
},
{
"type": "timeseries",
"title": "队列深度 / 九门失败",
"description": "面五 GenMetrics:gen_queue_depth(@Scheduled 刷在飞 queued+running 数)+ gen_gate_fail_total{gate}(九门逐门失败,§6)。",
"datasource": { "type": "prometheus", "uid": "prometheus" },
"gridPos": { "h": 8, "w": 8, "x": 16, "y": 16 },
"fieldConfig": { "defaults": {}, "overrides": [] },
"targets": [
{ "refId": "A", "expr": "max(gen_queue_depth)", "legendFormat": "队列深度" },
{ "refId": "B", "expr": "sum(rate(gen_gate_fail_total[30m])) by (gate)", "legendFormat": "门失败 {{gate}}" }
]
},
{
"type": "timeseries",
"title": "单次生成成本 ¥(自估值,非 new-api 权威计费)",
"description": "面五 GenMetrics:llm_cost DistributionSummary(源 worker trace.cost.totalRmb,§6/§7)。worker 按 token×倍率自估、非 new-api 权威流水,告警留余量。便宜档硬预算 < ¥10。",
"datasource": { "type": "prometheus", "uid": "prometheus" },
"gridPos": { "h": 8, "w": 8, "x": 0, "y": 24 },
"fieldConfig": { "defaults": { "unit": "currencyCNY" }, "overrides": [] },
"targets": [
{ "refId": "A", "expr": "sum(rate(llm_cost_sum[30m])) / clamp_min(sum(rate(llm_cost_count[30m])), 1)", "legendFormat": "单次均值¥" },
{ "refId": "B", "expr": "sum(increase(llm_cost_sum[1h]))", "legendFormat": "近1h累计¥" }
]
}
]
}