{
  "annotations": { "list": [] },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 1,
  "id": null,
  "links": [],
  "panels": [
    {
      "type": "stat",
      "title": "平台可用性（目标 ≥ 99.9%）",
      "id": 1,
      "datasource": { "type": "prometheus", "uid": "prometheus" },
      "gridPos": { "h": 5, "w": 5, "x": 0, "y": 0 },
      "targets": [{ "expr": "ai_platform_availability_ratio * 100", "refId": "A" }],
      "fieldConfig": {
        "defaults": {
          "unit": "percent",
          "decimals": 2,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              { "color": "red", "value": null },
              { "color": "yellow", "value": 99 },
              { "color": "green", "value": 99.9 }
            ]
          }
        }
      },
      "options": {
        "reduceOptions": { "calcs": ["lastNotNull"] },
        "colorMode": "background",
        "graphMode": "none",
        "textMode": "value"
      }
    },
    {
      "type": "stat",
      "title": "首 Token 延迟 P99（目标 ≤ 2s）",
      "id": 2,
      "datasource": { "type": "prometheus", "uid": "prometheus" },
      "gridPos": { "h": 5, "w": 5, "x": 5, "y": 0 },
      "targets": [{ "expr": "ai_sla_first_token_latency_p99_seconds", "refId": "A" }],
      "fieldConfig": {
        "defaults": {
          "unit": "s",
          "decimals": 2,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              { "color": "green", "value": null },
              { "color": "yellow", "value": 2 },
              { "color": "red", "value": 3 }
            ]
          }
        }
      },
      "options": {
        "reduceOptions": { "calcs": ["lastNotNull"] },
        "colorMode": "background",
        "graphMode": "none",
        "textMode": "value"
      }
    },
    {
      "type": "stat",
      "title": "完整响应延迟 P99（目标 ≤ 10s）",
      "id": 3,
      "datasource": { "type": "prometheus", "uid": "prometheus" },
      "gridPos": { "h": 5, "w": 5, "x": 10, "y": 0 },
      "targets": [{ "expr": "ai_sla_full_response_latency_p99_seconds", "refId": "A" }],
      "fieldConfig": {
        "defaults": {
          "unit": "s",
          "decimals": 2,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              { "color": "green", "value": null },
              { "color": "yellow", "value": 10 },
              { "color": "red", "value": 12 }
            ]
          }
        }
      },
      "options": {
        "reduceOptions": { "calcs": ["lastNotNull"] },
        "colorMode": "background",
        "graphMode": "none",
        "textMode": "value"
      }
    },
    {
      "type": "stat",
      "title": "知识库准确率（目标 ≥ 85%）",
      "id": 4,
      "datasource": { "type": "prometheus", "uid": "prometheus" },
      "gridPos": { "h": 5, "w": 4, "x": 15, "y": 0 },
      "targets": [{ "expr": "ai_sla_kb_accuracy_ratio * 100", "refId": "A" }],
      "fieldConfig": {
        "defaults": {
          "unit": "percent",
          "decimals": 1,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              { "color": "red", "value": null },
              { "color": "yellow", "value": 80 },
              { "color": "green", "value": 85 }
            ]
          }
        }
      },
      "options": {
        "reduceOptions": { "calcs": ["lastNotNull"] },
        "colorMode": "background",
        "graphMode": "none",
        "textMode": "value"
      }
    },
    {
      "type": "stat",
      "title": "故障恢复 MTTR（目标 ≤ 30min）",
      "id": 5,
      "datasource": { "type": "prometheus", "uid": "prometheus" },
      "gridPos": { "h": 5, "w": 5, "x": 19, "y": 0 },
      "targets": [{ "expr": "ai_sla_mttr_minutes", "refId": "A" }],
      "fieldConfig": {
        "defaults": {
          "unit": "m",
          "decimals": 1,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              { "color": "green", "value": null },
              { "color": "yellow", "value": 30 },
              { "color": "red", "value": 45 }
            ]
          }
        }
      },
      "options": {
        "reduceOptions": { "calcs": ["lastNotNull"] },
        "colorMode": "background",
        "graphMode": "none",
        "textMode": "value"
      }
    },
    {
      "type": "row",
      "title": "组件健康（绿 = UP，红 = DOWN；标题即组件名）",
      "id": 10,
      "gridPos": { "h": 1, "w": 24, "x": 0, "y": 5 },
      "collapsed": false,
      "panels": []
    },
    {
      "type": "stat",
      "title": "Dify 控制台",
      "description": "http://192.168.110.207  可用性计入 SLA",
      "id": 11,
      "datasource": { "type": "prometheus", "uid": "prometheus" },
      "gridPos": { "h": 5, "w": 5, "x": 0, "y": 6 },
      "targets": [
        {
          "expr": "ai_platform_component_up{component=\"dify\"}",
          "legendFormat": "Dify",
          "refId": "A"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "mappings": [
            {
              "type": "value",
              "options": {
                "0": { "text": "DOWN", "color": "red", "index": 0 },
                "1": { "text": "UP", "color": "green", "index": 1 }
              }
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              { "color": "red", "value": null },
              { "color": "green", "value": 1 }
            ]
          }
        }
      },
      "options": {
        "reduceOptions": { "calcs": ["lastNotNull"] },
        "orientation": "auto",
        "textMode": "value",
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "center"
      }
    },
    {
      "type": "stat",
      "title": "Langfuse 可观测",
      "description": "http://192.168.110.207:3000  可用性计入 SLA",
      "id": 12,
      "datasource": { "type": "prometheus", "uid": "prometheus" },
      "gridPos": { "h": 5, "w": 5, "x": 5, "y": 6 },
      "targets": [
        {
          "expr": "ai_platform_component_up{component=\"langfuse\"}",
          "legendFormat": "Langfuse",
          "refId": "A"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "mappings": [
            {
              "type": "value",
              "options": {
                "0": { "text": "DOWN", "color": "red", "index": 0 },
                "1": { "text": "UP", "color": "green", "index": 1 }
              }
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              { "color": "red", "value": null },
              { "color": "green", "value": 1 }
            ]
          }
        }
      },
      "options": {
        "reduceOptions": { "calcs": ["lastNotNull"] },
        "textMode": "value",
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "center"
      }
    },
    {
      "type": "stat",
      "title": "vLLM 推理（Qwen）",
      "description": "http://116.62.10.183:8000  可用性计入 SLA",
      "id": 13,
      "datasource": { "type": "prometheus", "uid": "prometheus" },
      "gridPos": { "h": 5, "w": 5, "x": 10, "y": 6 },
      "targets": [
        {
          "expr": "ai_platform_component_up{component=\"vllm\"}",
          "legendFormat": "vLLM",
          "refId": "A"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "mappings": [
            {
              "type": "value",
              "options": {
                "0": { "text": "DOWN", "color": "red", "index": 0 },
                "1": { "text": "UP", "color": "green", "index": 1 }
              }
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              { "color": "red", "value": null },
              { "color": "green", "value": 1 }
            ]
          }
        }
      },
      "options": {
        "reduceOptions": { "calcs": ["lastNotNull"] },
        "textMode": "value",
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "center"
      }
    },
    {
      "type": "stat",
      "title": "Xinference 向量",
      "description": "http://192.168.110.207:9997  bge-m3；不计入可用性分母",
      "id": 14,
      "datasource": { "type": "prometheus", "uid": "prometheus" },
      "gridPos": { "h": 5, "w": 4, "x": 15, "y": 6 },
      "targets": [
        {
          "expr": "ai_platform_component_up{component=\"xinference\"}",
          "legendFormat": "Xinference",
          "refId": "A"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "mappings": [
            {
              "type": "value",
              "options": {
                "0": { "text": "DOWN", "color": "red", "index": 0 },
                "1": { "text": "UP", "color": "green", "index": 1 }
              }
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              { "color": "red", "value": null },
              { "color": "green", "value": 1 }
            ]
          }
        }
      },
      "options": {
        "reduceOptions": { "calcs": ["lastNotNull"] },
        "textMode": "value",
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "center"
      }
    },
    {
      "type": "stat",
      "title": "vLLM 健康检查 API",
      "description": "作业5 :8779 /health；不计入可用性分母",
      "id": 15,
      "datasource": { "type": "prometheus", "uid": "prometheus" },
      "gridPos": { "h": 5, "w": 5, "x": 19, "y": 6 },
      "targets": [
        {
          "expr": "ai_platform_component_up{component=\"vllm_health_api\"}",
          "legendFormat": "vLLM健康API",
          "refId": "A"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "mappings": [
            {
              "type": "value",
              "options": {
                "0": { "text": "DOWN", "color": "red", "index": 0 },
                "1": { "text": "UP", "color": "green", "index": 1 }
              }
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              { "color": "red", "value": null },
              { "color": "green", "value": 1 }
            ]
          }
        }
      },
      "options": {
        "reduceOptions": { "calcs": ["lastNotNull"] },
        "textMode": "value",
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "center"
      }
    },
    {
      "type": "table",
      "title": "组件一览（名称 + 状态）",
      "id": 16,
      "datasource": { "type": "prometheus", "uid": "prometheus" },
      "gridPos": { "h": 7, "w": 24, "x": 0, "y": 11 },
      "targets": [
        {
          "expr": "ai_platform_component_up",
          "legendFormat": "{{name}}",
          "format": "table",
          "instant": true,
          "refId": "A"
        }
      ],
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true,
              "__name__": true,
              "env": true,
              "instance": true,
              "job": true,
              "platform": true,
              "component": false
            },
            "renameByName": {
              "name": "组件",
              "component": "内部ID",
              "Value": "状态"
            },
            "indexByName": {
              "name": 0,
              "component": 1,
              "Value": 2
            }
          }
        }
      ],
      "fieldConfig": {
        "overrides": [
          {
            "matcher": { "id": "byName", "options": "状态" },
            "properties": [
              {
                "id": "mappings",
                "value": [
                  {
                    "type": "value",
                    "options": {
                      "0": { "text": "DOWN", "color": "red", "index": 0 },
                      "1": { "text": "UP", "color": "green", "index": 1 }
                    }
                  }
                ]
              },
              { "id": "custom.displayMode", "value": "color-background" }
            ]
          }
        ]
      },
      "options": {
        "showHeader": true,
        "cellHeight": "sm",
        "footer": { "show": false }
      }
    },
    {
      "type": "row",
      "title": "趋势",
      "id": 20,
      "gridPos": { "h": 1, "w": 24, "x": 0, "y": 18 },
      "collapsed": false,
      "panels": []
    },
    {
      "type": "timeseries",
      "title": "SLA 延迟趋势",
      "id": 21,
      "datasource": { "type": "prometheus", "uid": "prometheus" },
      "gridPos": { "h": 8, "w": 12, "x": 0, "y": 19 },
      "targets": [
        { "expr": "ai_sla_first_token_latency_p99_seconds", "legendFormat": "首Token P99", "refId": "A" },
        { "expr": "ai_sla_full_response_latency_p99_seconds", "legendFormat": "完整响应 P99", "refId": "B" },
        { "expr": "ai_sla_target_first_token_seconds", "legendFormat": "首Token 目标 2s", "refId": "C" },
        { "expr": "ai_sla_target_full_response_seconds", "legendFormat": "完整响应 目标 10s", "refId": "D" }
      ],
      "fieldConfig": { "defaults": { "unit": "s", "custom": { "drawStyle": "line", "lineWidth": 2 } } }
    },
    {
      "type": "timeseries",
      "title": "平台可用性 %",
      "id": 22,
      "datasource": { "type": "prometheus", "uid": "prometheus" },
      "gridPos": { "h": 8, "w": 12, "x": 12, "y": 19 },
      "targets": [
        { "expr": "ai_platform_availability_ratio * 100", "legendFormat": "可用性", "refId": "A" },
        { "expr": "ai_sla_target_availability_ratio * 100", "legendFormat": "目标 99.9%", "refId": "B" }
      ],
      "fieldConfig": { "defaults": { "unit": "percent", "decimals": 2, "custom": { "drawStyle": "line", "lineWidth": 2 } } }
    }
  ],
  "refresh": "15s",
  "schemaVersion": 39,
  "tags": ["workbuddy", "sla", "homework8"],
  "templating": { "list": [] },
  "time": { "from": "now-6h", "to": "now" },
  "timepicker": {},
  "timezone": "browser",
  "title": "AI 平台 SLA 运维大屏",
  "uid": "ai-platform-sla",
  "version": 2
}
