geo/docs/04-API文档/health.md

2.1 KiB
Raw Permalink Blame History

健康检查API

健康检查API用于监控系统运行状态。

端点列表

方法 路径 说明
GET /health 服务健康检查
GET /health/ready 就绪检查
GET /health/live 存活检查

健康检查

GET /health

响应

{
  "status": "healthy",
  "timestamp": "2024-01-01T00:00:00Z",
  "components": {
    "database": "healthy",
    "redis": "healthy"
  }
}

就绪检查

检查服务是否准备好接收请求。

GET /health/ready

检查项

  • 数据库连接
  • Redis连接
  • 磁盘空间
  • 内存使用率

响应

{
  "status": "ready",
  "checks": {
    "database": {
      "status": "ok",
      "latency_ms": 5
    },
    "redis": {
      "status": "ok",
      "latency_ms": 2
    },
    "disk_space": {
      "status": "ok",
      "free_percent": 70
    },
    "memory": {
      "status": "ok",
      "usage_percent": 65
    }
  }
}

存活检查

检查服务进程是否存活。

GET /health/live

响应

{
  "status": "alive",
  "uptime_seconds": 3600
}

监控指标

Prometheus格式指标端点

GET /metrics

可用指标

指标 类型 说明
geo_http_requests_total Counter HTTP请求总数
geo_http_request_duration_seconds Histogram 请求延迟
geo_agent_tasks_total Counter Agent任务总数
geo_agent_task_duration_seconds Histogram 任务执行时间
geo_queue_depth Gauge 队列深度
geo_database_connections Gauge 数据库连接数
geo_redis_connections Gauge Redis连接数

相关API

诊断模块

诊断模块提供SEO和GEO诊断能力包含以下端点

端点 描述
GET /api/v1/diagnosis/seo/{brand_id} 获取品牌的SEO诊断结果
GET /api/v1/diagnosis/geo/{brand_id} 获取品牌的GEO诊断结果
GET /api/v1/diagnosis/combined/{brand_id} 获取品牌的SEO+GEO综合诊断结果

详细说明请查看 诊断模块文档