Files
Edu/infra/prometheus.yml
SpecialX a6b0c54fba fix: 修复登录路由 + 端口冲突 + Prometheus 配置 + outbox 表结构 + 补充监控基础设施
1. teacher-portal 登录 JSON 解析错误修复
   - 根因:next.config.js rewrites /api/auth/* → gateway /api/auth/*,
     但 gateway 只在 /api/v1 路由组下注册代理,/api/auth/* 返回 404 纯文本
   - 修复:rewrites 映射 /api/auth/* → /api/v1/iam/*(对齐 iam controller @Controller("v1/iam"))

2. msg / data-ana 端口冲突修复
   - 根因:msg env.ts PORT 默认 3006,与 data-ana(config.py http_port=3006)冲突
   - 修复:msg PORT 默认 3006→3007(对齐端口分配表 msg=3007, data-ana=3006)

3. Prometheus classes-service 3001 DOWN 修复
   - 根因:classes 已合并入 core-edu(P3 裁决 C1),但 prometheus.yml 仍有 classes-service scrape 配置
   - 修复:从 prometheus.yml 删除 classes-service job

4. iam outbox 表 aggregate_id 列长度修复
   - 根因:iam_outbox.aggregate_id VARCHAR(32),但 UUID 是 36 字符,导致 "Data too long" 错误
   - 修复:DDL 中 VARCHAR(32) → VARCHAR(36);ALTER TABLE 修复现有数据库

5. 补充未搭建的监控基础设施
   - docker-compose.yml 新增 Alertmanager(9093)/ Loki(3100)/ Promtail(observability profile)
   - prometheus.yml alertmanager target 更新为 edu-alertmanager:9093

验证:
- TS typecheck 19 项目全部通过
- 登录链路 teacher-portal → gateway → iam 验证通过
- Prometheus targets 不再有 classes-service
- 3 个新基础设施容器(alertmanager/loki/promtail)启动成功

AI identity: trae-main(基础设施修复会话)
2026-07-11 09:22:09 +08:00

90 lines
2.3 KiB
YAML
Raw Permalink 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.
global:
scrape_interval: 15s
evaluation_interval: 15s
# 告警规则文件
rule_files:
- /etc/prometheus/rules.yml
# 告警管理器
alerting:
alertmanagers:
- static_configs:
- targets:
- edu-alertmanager:9093
scrape_configs:
# ============================================================
# 应用服务NestJS / FastAPI 暴露 /metrics
# classes 已合并入 core-eduP3 裁决 C13001 端口已废弃
# ============================================================
- job_name: 'iam-service'
static_configs:
- targets: ['host.docker.internal:3002']
labels:
service: iam
- job_name: 'teacher-bff'
static_configs:
- targets: ['host.docker.internal:3003']
labels:
service: teacher-bff
- job_name: 'core-edu-service'
static_configs:
- targets: ['host.docker.internal:3004']
labels:
service: core-edu
- job_name: 'content-service'
static_configs:
- targets: ['host.docker.internal:3005']
labels:
service: content
- job_name: 'data-ana-service'
static_configs:
- targets: ['host.docker.internal:3006']
labels:
service: data-ana
- job_name: 'msg-service'
static_configs:
- targets: ['host.docker.internal:3007']
labels:
service: msg
- job_name: 'ai-service'
static_configs:
- targets: ['host.docker.internal:3008']
labels:
service: ai
# ============================================================
# 基础设施docker-compose.minimal/minimal.override
# ============================================================
- job_name: 'mysql'
static_configs:
- targets: ['host.docker.internal:9104']
labels:
service: mysql
- job_name: 'redis'
static_configs:
- targets: ['host.docker.internal:9121']
labels:
service: redis
# ============================================================
# 监控栈自身
# ============================================================
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
- job_name: 'node-exporter'
static_configs:
- targets: ['host.docker.internal:9100']
labels:
service: node-exporter