## 主要改动 ### docker-compose.yml - fund-sys 服务改为混合模式部署: - fund-sys-shared: 共享实例(8100端口),供所有租户使用 - fund-sys-vip001: VIP_001专属实例(8101端口) - 预留VIP_002模板(注释状态) - 添加TENANT_ID、TENANT_GROUP环境变量 ### NacosMetadataConfig - 支持从环境变量读取租户元数据(优先级最高) - 动态注册租户标签到Nacos - 区分共享实例和VIP专属实例 ### Prometheus配置 - 监控共享实例和VIP实例 - 添加tenant_mode、tenant_group标签 ## 混合模式说明 - 共享实例(TENANT_GROUP为空): 所有普通租户请求路由到此类实例 - VIP实例(TENANT_GROUP有值): VIP租户请求路由到专属实例
167 lines
4.3 KiB
YAML
167 lines
4.3 KiB
YAML
# Prometheus 配置文件
|
|
# 资金服务平台监控配置
|
|
|
|
global:
|
|
scrape_interval: 15s # 抓取间隔
|
|
evaluation_interval: 15s # 规则评估间隔
|
|
external_labels:
|
|
monitor: 'fund-platform'
|
|
|
|
# 告警管理器配置(可选)
|
|
# alerting:
|
|
# alertmanagers:
|
|
# - static_configs:
|
|
# - targets:
|
|
# - alertmanager:9093
|
|
|
|
# 规则文件
|
|
rule_files:
|
|
- /etc/prometheus/rules/*.yml
|
|
|
|
# 抓取配置
|
|
scrape_configs:
|
|
# ==================== 基础设施监控 ====================
|
|
|
|
# Prometheus 自身监控
|
|
- job_name: 'prometheus'
|
|
static_configs:
|
|
- targets: ['localhost:9090']
|
|
labels:
|
|
instance: 'prometheus'
|
|
|
|
# MySQL 监控 (需要 mysqld_exporter)
|
|
# - job_name: 'mysql'
|
|
# static_configs:
|
|
# - targets: ['mysql-exporter:9104']
|
|
|
|
# Redis 监控 (需要 redis_exporter)
|
|
# - job_name: 'redis'
|
|
# static_configs:
|
|
# - targets: ['redis-exporter:9121']
|
|
|
|
# ==================== Spring Boot 微服务监控 ====================
|
|
|
|
# API 网关
|
|
- job_name: 'fund-gateway'
|
|
metrics_path: '/actuator/prometheus'
|
|
static_configs:
|
|
- targets: ['gateway:8000']
|
|
labels:
|
|
application: 'fund-gateway'
|
|
service: 'gateway'
|
|
relabel_configs:
|
|
- source_labels: [__address__]
|
|
target_label: instance
|
|
replacement: 'fund-gateway'
|
|
|
|
# 系统服务 - 多租户混合模式监控
|
|
- job_name: 'fund-sys'
|
|
metrics_path: '/actuator/prometheus'
|
|
static_configs:
|
|
# 共享实例
|
|
- targets: ['fund-sys:8100']
|
|
labels:
|
|
application: 'fund-sys'
|
|
service: 'business'
|
|
tenant_mode: 'shared'
|
|
instance: 'fund-sys-shared'
|
|
# VIP_001 专属实例
|
|
- targets: ['fund-sys-vip001:8101']
|
|
labels:
|
|
application: 'fund-sys'
|
|
service: 'business'
|
|
tenant_mode: 'vip'
|
|
tenant_group: 'TENANT_VIP_001'
|
|
instance: 'fund-sys-vip001'
|
|
|
|
# 客户服务
|
|
- job_name: 'fund-cust'
|
|
metrics_path: '/actuator/prometheus'
|
|
static_configs:
|
|
- targets: ['fund-cust:8200']
|
|
labels:
|
|
application: 'fund-cust'
|
|
service: 'business'
|
|
relabel_configs:
|
|
- source_labels: [__address__]
|
|
target_label: instance
|
|
replacement: 'fund-cust'
|
|
|
|
# 项目服务
|
|
- job_name: 'fund-proj'
|
|
metrics_path: '/actuator/prometheus'
|
|
static_configs:
|
|
- targets: ['fund-proj:8300']
|
|
labels:
|
|
application: 'fund-proj'
|
|
service: 'business'
|
|
relabel_configs:
|
|
- source_labels: [__address__]
|
|
target_label: instance
|
|
replacement: 'fund-proj'
|
|
|
|
# 需求工单服务
|
|
- job_name: 'fund-req'
|
|
metrics_path: '/actuator/prometheus'
|
|
static_configs:
|
|
- targets: ['fund-req:8400']
|
|
labels:
|
|
application: 'fund-req'
|
|
service: 'business'
|
|
relabel_configs:
|
|
- source_labels: [__address__]
|
|
target_label: instance
|
|
replacement: 'fund-req'
|
|
|
|
# 支出服务
|
|
- job_name: 'fund-exp'
|
|
metrics_path: '/actuator/prometheus'
|
|
static_configs:
|
|
- targets: ['fund-exp:8500']
|
|
labels:
|
|
application: 'fund-exp'
|
|
service: 'business'
|
|
relabel_configs:
|
|
- source_labels: [__address__]
|
|
target_label: instance
|
|
replacement: 'fund-exp'
|
|
|
|
# 收款服务
|
|
- job_name: 'fund-receipt'
|
|
metrics_path: '/actuator/prometheus'
|
|
static_configs:
|
|
- targets: ['fund-receipt:8600']
|
|
labels:
|
|
application: 'fund-receipt'
|
|
service: 'business'
|
|
relabel_configs:
|
|
- source_labels: [__address__]
|
|
target_label: instance
|
|
replacement: 'fund-receipt'
|
|
|
|
# 报表服务
|
|
- job_name: 'fund-report'
|
|
metrics_path: '/actuator/prometheus'
|
|
static_configs:
|
|
- targets: ['fund-report:8700']
|
|
labels:
|
|
application: 'fund-report'
|
|
service: 'business'
|
|
relabel_configs:
|
|
- source_labels: [__address__]
|
|
target_label: instance
|
|
replacement: 'fund-report'
|
|
|
|
# 文件服务
|
|
- job_name: 'fund-file'
|
|
metrics_path: '/actuator/prometheus'
|
|
static_configs:
|
|
- targets: ['fund-file:8800']
|
|
labels:
|
|
application: 'fund-file'
|
|
service: 'business'
|
|
relabel_configs:
|
|
- source_labels: [__address__]
|
|
target_label: instance
|
|
replacement: 'fund-file'
|