Umfangreiches Refactoring der Projektkonfiguration zur klaren Trennung von Build-, Runtime- und Applikations-Logik. Änderungen im Detail: - Struktur: Neuorganisation des `config/` Verzeichnisses in logische Bereiche: - `config/docker`: Reine Infrastruktur-Configs (Postgres, Redis, Nginx, Monitoring). - `config/quality`: Statische Code-Analyse (Detekt, Lint). - `config/app`: Gemeinsame Spring-Boot-Konfigurationen. - Docker Compose: - Einführung von Profilen (`infra`, `backend`, `ops`, `gui`, `tools`) für gezieltes Starten von Teilbereichen. - Anpassung aller Volume-Pfade auf die neue Struktur. - Spring Boot Config: - Zentralisierung gemeinsamer Einstellungen (Datasource, Redis, JPA) in `config/app/base-application.yml`. - Parametrisierung der Hosts für nahtlosen Wechsel zwischen Docker und Localhost. - Bereinigung der service-spezifischen `application.yaml` Dateien (z.B. Ping-Service). - Cleanup: Entfernen redundanter "Ghost-Files" (`versions.toml`, `central.toml`, `config/.env`), um eine echte Single Source of Truth (SSoT) zu gewährleisten.
69 lines
2.2 KiB
YAML
69 lines
2.2 KiB
YAML
# ===================================================================
|
|
# Prometheus Configuration for Meldestelle
|
|
# Features: Consul Service Discovery, Spring Boot Actuator support
|
|
# ===================================================================
|
|
|
|
global:
|
|
scrape_interval: 15s
|
|
evaluation_interval: 15s
|
|
|
|
# Alertmanager configuration
|
|
alerting:
|
|
alertmanagers:
|
|
- static_configs:
|
|
- targets:
|
|
# Da wir Alertmanager noch nicht im Docker Compose haben (kommt noch!),
|
|
# lassen wir das vorerst auskommentiert oder fügen den Container hinzu.
|
|
- "alertmanager:9093"
|
|
|
|
rule_files:
|
|
- "/etc/prometheus/rules/alerts.yaml"
|
|
|
|
scrape_configs:
|
|
# 1. Prometheus Self-Monitoring
|
|
- job_name: 'prometheus'
|
|
static_configs:
|
|
- targets: [ 'localhost:9090' ]
|
|
|
|
# 2. Consul Self-Monitoring
|
|
- job_name: 'consul'
|
|
metrics_path: '/v1/agent/metrics'
|
|
params:
|
|
format: [ 'prometheus' ]
|
|
static_configs:
|
|
- targets: [ 'consul:8500' ]
|
|
|
|
# 3. Spring Boot Services via Consul Discovery.
|
|
# Das ist die Magie: Prometheus fragt Consul nach allen Services.
|
|
# Wenn ein Service das Tag 'metrics' oder 'spring-boot' hat (oder einfach alle), wird er scraped.
|
|
- job_name: 'consul-services'
|
|
consul_sd_configs:
|
|
- server: 'consul:8500'
|
|
services: [ ] # Leere Liste = Alle Services
|
|
|
|
relabel_configs:
|
|
# Nur Services scrapen, die NICHT consul selbst sind (das haben wir oben schon)
|
|
- source_labels: [ __meta_consul_service ]
|
|
regex: consul
|
|
action: drop
|
|
|
|
# Setze den Pfad auf /actuator/prometheus für Spring Boot Apps
|
|
# Optional: Man kann das auch über Consul Tags steuern
|
|
- source_labels: [ __meta_consul_service ]
|
|
target_label: __metrics_path__
|
|
replacement: /actuator/prometheus
|
|
|
|
# Übernehme den Service-Namen als 'application' Label
|
|
- source_labels: [ __meta_consul_service ]
|
|
target_label: application
|
|
|
|
# Behalte die Instanz (IP: Port)
|
|
- source_labels: [ __meta_consul_address, __meta_consul_service_port ]
|
|
separator: ':'
|
|
target_label: instance
|
|
|
|
# Job 4: Postgres Exporter (Statisch, da kein Consul-Client im Image)
|
|
- job_name: 'postgres-exporter'
|
|
static_configs:
|
|
- targets: [ 'postgres-exporter:9187' ]
|