This repository provides an example of implementing observability in a Spring Boot application. Observability enables monitoring and understanding the internal state of a system by collecting and analyzing logs, metrics, and traces.
- Spring Boot Application: Demonstrates observability practices within a Spring Boot framework.
- Docker Compose Integration: Orchestrates services, including the application and observability tools, using Docker Compose.
- PostgreSQL Database: Integrates with a PostgreSQL database for data persistence.
- Zipkin for Distributed Tracing: Implements Zipkin to collect and visualize trace data, aiding in performance monitoring and troubleshooting.
- MapStruct for Object Mapping: Utilizes MapStruct for efficient and type-safe object mapping between DTOs and entities.
- Spring Security: Secures application endpoints using Spring Security.
- Swagger/OpenAPI Documentation: Provides interactive API documentation with Swagger UI.
Ensure you have the following installed:
git clone https://github.com/youssefGamalMohamed/observability-spring-boot.git
cd observability-spring-boot./mvnw clean installdocker-compose upThis command will start the Spring Boot application, PostgreSQL database, and Zipkin for tracing.
- Application Endpoint:
http://localhost:8080 - Swagger UI:
http://localhost:8080/swagger-ui.html - Zipkin Dashboard:
http://localhost:9411
- Metrics: Exposed via Spring Boot Actuator at
http://localhost:8080/actuator/metrics. - Health Checks: Available at
http://localhost:8080/actuator/health. - Distributed Tracing: Visualize traces using the Zipkin dashboard at
http://localhost:9411.
The application uses Spring Security to protect endpoints. Configure security settings in the application.yml file.
Interactive API documentation is available through Swagger UI at http://localhost:8080/swagger-ui.html.
For further reading on observability in Spring Boot, consider exploring the following resources: