How blueswen/spring-boot-observability works
Main Components
• Spring Boot Applications: Represent “app” as the central service codebase. Note that although the code is shared, the demo runs three instances (app-a, app-b, app-c) to illustrate distributed behavior and cross-service communication.
• Observability Pipeline:
• Tracing: OpenTelemetry instrumentation that sends span data to Tempo.
• Metrics: Prometheus scrapes metrics (exposed via Spring Boot Actuator and Micrometer) and handles exemplars.
• Logs: Loki collects container logs enriched with trace details using the Loki Docker Driver.
• Grafana: Acts as the unified dashboard that queries all three data sources (Prometheus, Tempo, Loki) to correlate traces, metrics, and logs.
• Supporting Configuration and Orchestration: Include Docker Compose (which orchestrates containerized services) and configuration directories (etc for dashboards, grafana datasource configurations, Prometheus config, etc).
Relationships and Data Flows
• The Spring Boot applications serve client HTTP requests and expose endpoints (including Swagger endpoints and /actuator/prometheus for metrics).
• Outbound instrumentation flows:
• For traces: The OpenTelemetry Java Agent automatically intercepts and forwards spans to Tempo.
• For metrics: Actuator/Micrometer expose Prometheus-format metrics which are scraped by Prometheus.
• For logs: The configured Logback (with modified logging pattern that includes trace context) is sent via the Loki Docker Driver to Loki.
• Grafana sits as the front-end dashboard and pulls data from Prometheus (with exemplars linking to Tempo), Tempo (for traces), and Loki (for logs), and orchestrates the correlations between these systems.
Architectural Patterns and Components
• Containerized Microservices: Though the code is shared, the demo involves multiple instances to simulate distributed tracing across services.
• Use of External Agents and Auto-Instrumentation: Indicate that the OpenTelemetry agent enriches the application without code changes.
• Integration with External Monitoring Tools: Show how Prometheus scrapes endpoints, Tempo receives spans, and Loki aggregates logs—all configured in the “etc” folder.