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:
53
deploy/monitoring/promtail/config.yml
Normal file
53
deploy/monitoring/promtail/config.yml
Normal file
@@ -0,0 +1,53 @@
|
||||
server:
|
||||
http_listen_port: 9080
|
||||
grpc_listen_port: 0
|
||||
|
||||
positions:
|
||||
filename: /tmp/positions.yml
|
||||
|
||||
clients:
|
||||
- url: http://loki:3100/loki/api/v1/push
|
||||
|
||||
scrape_configs:
|
||||
- job_name: docker
|
||||
docker_sd_configs:
|
||||
- host: unix:///var/run/docker.sock
|
||||
refresh_interval: 15s
|
||||
relabel_configs:
|
||||
- source_labels: ['__meta_docker_container_name']
|
||||
regex: '/(.*)'
|
||||
target_label: container
|
||||
- source_labels: ['__meta_docker_container_label_com_docker_compose_service']
|
||||
target_label: compose_service
|
||||
- source_labels: ['__meta_docker_container_label_com_docker_compose_project']
|
||||
target_label: compose_project
|
||||
pipeline_stages:
|
||||
- docker: {}
|
||||
- match:
|
||||
selector: '{compose_service="server"} |= "Slow API request"'
|
||||
stages:
|
||||
- metrics:
|
||||
ftb_slow_api_log_total:
|
||||
type: Counter
|
||||
description: Slow API request log entries emitted by the NestJS server.
|
||||
config:
|
||||
action: inc
|
||||
- match:
|
||||
selector: '{compose_service="server"} |= "Slow Prisma query"'
|
||||
stages:
|
||||
- metrics:
|
||||
ftb_slow_prisma_log_total:
|
||||
type: Counter
|
||||
description: Slow Prisma query log entries emitted by the NestJS server.
|
||||
config:
|
||||
action: inc
|
||||
- match:
|
||||
selector: '{compose_service="server"} |~ "AppData relation sync failed|AI 调用失败|AI 风险解读调用失败"'
|
||||
stages:
|
||||
- metrics:
|
||||
ftb_job_failure_log_total:
|
||||
type: Counter
|
||||
description: Compatibility sync, AI job, or background task failure logs.
|
||||
config:
|
||||
action: inc
|
||||
|
||||
Reference in New Issue
Block a user