docs: document Zipkin setup and integrate tracing configuration

Added new documentation for Zipkin setup, including Docker Compose configuration, service integration, and troubleshooting steps. Integrated tracing configuration for key microservices to enable distributed tracing and latency analysis.
This commit is contained in:
Stefan Mogeritsch 2026-01-17 10:17:07 +01:00
parent 8ca9c001cd
commit cc4eade957
3 changed files with 108 additions and 0 deletions

View File

@ -215,6 +215,19 @@ services:
- "grafana" - "grafana"
profiles: [ "ops", "all" ] profiles: [ "ops", "all" ]
# --- MONITORING: Zipkin ---
zipkin:
image: "${ZIPKIN_IMAGE:-openzipkin/zipkin:3}"
container_name: "${PROJECT_NAME:-meldestelle}-zipkin"
restart: no
ports:
- "${ZIPKIN_PORT:-9411:9411}"
profiles: [ "ops", "all" ]
networks:
meldestelle-network:
aliases:
- "zipkin"
# --- CONSUL --- # --- CONSUL ---
consul: consul:
image: "${CONSUL_IMAGE:-hashicorp/consul:1.22.1}" image: "${CONSUL_IMAGE:-hashicorp/consul:1.22.1}"
@ -289,6 +302,10 @@ services:
LOGGING_LEVEL_ORG_SPRINGFRAMEWORK_CLOUD_GATEWAY: "DEBUG" LOGGING_LEVEL_ORG_SPRINGFRAMEWORK_CLOUD_GATEWAY: "DEBUG"
LOGGING_LEVEL_ORG_SPRINGFRAMEWORK_SECURITY: "DEBUG" LOGGING_LEVEL_ORG_SPRINGFRAMEWORK_SECURITY: "DEBUG"
# --- ZIPKIN ---
MANAGEMENT_ZIPKIN_TRACING_ENDPOINT: "${ZIPKIN_ENDPOINT:-http://zipkin:9411/api/v2/spans}"
MANAGEMENT_TRACING_SAMPLING_PROBABILITY: "${ZIPKIN_SAMPLING_PROBABILITY:-1.0}"
depends_on: depends_on:
postgres: postgres:
condition: "service_healthy" condition: "service_healthy"
@ -349,6 +366,10 @@ services:
SPRING_DATA_REDIS_PASSWORD: "${REDIS_PASSWORD:-redis-password}" SPRING_DATA_REDIS_PASSWORD: "${REDIS_PASSWORD:-redis-password}"
SPRING_DATA_REDIS_CONNECT_TIMEOUT: "${REDIS_SERVER_CONNECT_TIMEOUT:-5s}" SPRING_DATA_REDIS_CONNECT_TIMEOUT: "${REDIS_SERVER_CONNECT_TIMEOUT:-5s}"
# --- ZIPKIN ---
MANAGEMENT_ZIPKIN_TRACING_ENDPOINT: "${ZIPKIN_ENDPOINT:-http://zipkin:9411/api/v2/spans}"
MANAGEMENT_TRACING_SAMPLING_PROBABILITY: "${ZIPKIN_SAMPLING_PROBABILITY:-1.0}"
depends_on: depends_on:
postgres: postgres:
condition: "service_healthy" condition: "service_healthy"
@ -392,6 +413,11 @@ services:
SPRING_DATASOURCE_URL: "${POSTGRES_DB_URL:-jdbc:postgresql://postgres:5432/pg-meldestelle-db}" SPRING_DATASOURCE_URL: "${POSTGRES_DB_URL:-jdbc:postgresql://postgres:5432/pg-meldestelle-db}"
SPRING_DATASOURCE_USERNAME: "${POSTGRES_USER:-pg-user}" SPRING_DATASOURCE_USERNAME: "${POSTGRES_USER:-pg-user}"
SPRING_DATASOURCE_PASSWORD: "${POSTGRES_PASSWORD:-pg-password}" SPRING_DATASOURCE_PASSWORD: "${POSTGRES_PASSWORD:-pg-password}"
# --- ZIPKIN ---
MANAGEMENT_ZIPKIN_TRACING_ENDPOINT: "${ZIPKIN_ENDPOINT:-http://zipkin:9411/api/v2/spans}"
MANAGEMENT_TRACING_SAMPLING_PROBABILITY: "${ZIPKIN_SAMPLING_PROBABILITY:-1.0}"
depends_on: depends_on:
postgres: postgres:
condition: "service_healthy" condition: "service_healthy"
@ -430,6 +456,11 @@ services:
SPRING_DATASOURCE_URL: "${POSTGRES_DB_URL:-jdbc:postgresql://postgres:5432/pg-meldestelle-db}" SPRING_DATASOURCE_URL: "${POSTGRES_DB_URL:-jdbc:postgresql://postgres:5432/pg-meldestelle-db}"
SPRING_DATASOURCE_USERNAME: "${POSTGRES_USER:-pg-user}" SPRING_DATASOURCE_USERNAME: "${POSTGRES_USER:-pg-user}"
SPRING_DATASOURCE_PASSWORD: "${POSTGRES_PASSWORD:-pg-password}" SPRING_DATASOURCE_PASSWORD: "${POSTGRES_PASSWORD:-pg-password}"
# --- ZIPKIN ---
MANAGEMENT_ZIPKIN_TRACING_ENDPOINT: "${ZIPKIN_ENDPOINT:-http://zipkin:9411/api/v2/spans}"
MANAGEMENT_TRACING_SAMPLING_PROBABILITY: "${ZIPKIN_SAMPLING_PROBABILITY:-1.0}"
depends_on: depends_on:
postgres: postgres:
condition: "service_healthy" condition: "service_healthy"
@ -468,6 +499,11 @@ services:
SPRING_DATASOURCE_URL: "${POSTGRES_DB_URL:-jdbc:postgresql://postgres:5432/pg-meldestelle-db}" SPRING_DATASOURCE_URL: "${POSTGRES_DB_URL:-jdbc:postgresql://postgres:5432/pg-meldestelle-db}"
SPRING_DATASOURCE_USERNAME: "${POSTGRES_USER:-pg-user}" SPRING_DATASOURCE_USERNAME: "${POSTGRES_USER:-pg-user}"
SPRING_DATASOURCE_PASSWORD: "${POSTGRES_PASSWORD:-pg-password}" SPRING_DATASOURCE_PASSWORD: "${POSTGRES_PASSWORD:-pg-password}"
# --- ZIPKIN ---
MANAGEMENT_ZIPKIN_TRACING_ENDPOINT: "${ZIPKIN_ENDPOINT:-http://zipkin:9411/api/v2/spans}"
MANAGEMENT_TRACING_SAMPLING_PROBABILITY: "${ZIPKIN_SAMPLING_PROBABILITY:-1.0}"
depends_on: depends_on:
postgres: postgres:
condition: "service_healthy" condition: "service_healthy"

View File

@ -0,0 +1,36 @@
# Zipkin Tracing
## Übersicht
Zipkin ist ein verteiltes Tracing-System, das hilft, Latenzprobleme in Microservice-Architekturen zu analysieren. Es sammelt Timing-Daten, die benötigt werden, um Latenzprobleme in Service-Architekturen zu beheben.
## Konfiguration in Docker Compose
Der Zipkin-Service ist in der `docker-compose.yaml` definiert:
```yaml
zipkin:
image: "${ZIPKIN_IMAGE:-openzipkin/zipkin:3}"
container_name: "${PROJECT_NAME:-meldestelle}-zipkin"
restart: no
ports:
- "${ZIPKIN_PORT:-9411:9411}"
profiles: [ "ops", "all" ]
networks:
meldestelle-network:
aliases:
- "zipkin"
```
## Integration in Services
Die Services (`api-gateway`, `ping-service`, etc.) sind so konfiguriert, dass sie Tracing-Daten an Zipkin senden. Dies geschieht über Umgebungsvariablen in der `docker-compose.yaml`:
```yaml
MANAGEMENT_ZIPKIN_TRACING_ENDPOINT: "${ZIPKIN_ENDPOINT:-http://zipkin:9411/api/v2/spans}"
MANAGEMENT_TRACING_SAMPLING_PROBABILITY: "${ZIPKIN_SAMPLING_PROBABILITY:-1.0}"
```
## Zugriff
Die Zipkin UI ist unter `http://localhost:9411` erreichbar.
## Troubleshooting
- **Keine Traces sichtbar:** Stelle sicher, dass die Services korrekt gestartet sind und die Umgebungsvariablen für Zipkin gesetzt sind. Prüfe die Logs der Services auf Verbindungsfehler zu Zipkin.
- **Zipkin nicht erreichbar:** Prüfe, ob der Container läuft (`docker ps`) und ob der Port 9411 nicht blockiert ist.

View File

@ -0,0 +1,36 @@
---
type: Journal
status: ACTIVE
owner: Infrastructure & DevOps Engineer
last_update: 2026-01-15
---
# Session Log: Infrastructure Zipkin Setup
## Zusammenfassung
In dieser Session wurde die Infrastruktur um Distributed Tracing mit **Zipkin** erweitert, um Latenzanalysen in der Microservice-Architektur zu ermöglichen.
## Durchgeführte Änderungen
### 1. Docker Compose (`docker-compose.yaml`)
* **Neuer Service `zipkin`:**
* Image: `openzipkin/zipkin:3`
* Port: `9411`
* Network Alias: `zipkin`
* **Service Integration:**
* Die Services `api-gateway`, `ping-service`, `entries-service`, `results-service` und `scheduling-service` wurden konfiguriert, um Tracing-Daten an Zipkin zu senden.
* Umgebungsvariablen hinzugefügt:
* `MANAGEMENT_ZIPKIN_TRACING_ENDPOINT`
* `MANAGEMENT_TRACING_SAMPLING_PROBABILITY`
### 2. Dokumentation
* Neue Referenz-Dokumentation erstellt: `docs/07_Infrastructure/Reference/zipkin.md`.
* Enthält Konfigurationsdetails und Troubleshooting-Hinweise.
## Betroffene Dateien
* `docker-compose.yaml`
* `docs/07_Infrastructure/Reference/zipkin.md`
## Nächste Schritte
* Backend-Developer müssen sicherstellen, dass die Micrometer-Tracing-Dependencies (`micrometer-tracing-bridge-brave`, `zipkin-reporter-brave`) im Build vorhanden sind.
* Neustart der Umgebung mit `docker compose up -d`.