# Author: fruit.com.cn # Prometheus 抓取配置:全部走 compose 内网的服务名解析。 # - 应用指标:Spring Boot actuator # - 容器指标:cAdvisor # - 探活/耗时:blackbox-exporter(不依赖后端代码,从外部看接口是否可用) global: scrape_interval: 15s evaluation_interval: 15s external_labels: project: fruitshorts scrape_configs: - job_name: "fruitshorts-app-api" metrics_path: "/actuator/prometheus" static_configs: - targets: ["app-api:8081"] - job_name: "fruitshorts-admin-api" metrics_path: "/actuator/prometheus" static_configs: - targets: ["admin-api:8080"] - job_name: "prometheus" static_configs: - targets: ["localhost:9090"] # 容器 CPU / 内存 / 网络 / 重启次数 - job_name: "cadvisor" static_configs: - targets: ["cadvisor:8080"] # 入口探活:healthz 用于存活判定,两个业务接口用于可用性与耗时 - job_name: "blackbox" metrics_path: /probe params: module: [http_2xx] static_configs: - targets: - http://app-api:8081/healthz - http://admin-api:8080/healthz - http://app-api:8081/app/categories - http://app-api:8081/app/home/feed relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: blackbox:9115