13 Observability and monitoring

 

This chapter covers

  • Logging with Spring Boot, Loki, and Fluent Bit
  • Using health probes with Spring Boot Actuator and Kubernetes
  • Producing metrics with Spring Boot Actuator, Prometheus, and Grafana
  • Configuring distributed tracing with OpenTelemetry and Tempo
  • Managing applications with Spring Boot Actuator

In the previous chapters, you learned about several patterns and technologies you can use to build secure, scalable, and resilient applications. However, we still lack visibility into the Polar Bookshop system, especially when something goes wrong. Before going to production, we should ensure our applications are observable and that the deployment platform provides all the tools needed to monitor and gain insights into the system.

Monitoring involves checking the telemetry available for the application and defining alerts for known failure states. Observability goes beyond that and aims at reaching a state where we can ask arbitrary questions about the system without knowing the question in advance. The product team should ensure their applications expose relevant information; and the platform team should provide an infrastructure for consuming that information and asking questions about their operations.

13.1 Logging with Spring Boot, Loki, and Fluent Bit

13.1.1 Logging with Spring Boot

13.1.2 Managing logs with Loki, Fluent Bit, and Grafana

13.2 Health probes with Spring Boot Actuator and Kubernetes

13.2.1 Defining health probes for Spring Boot applications using Actuator

13.2.2 Configuring health probes in Spring Boot and Kubernetes

13.3 Metrics and monitoring with Spring Boot Actuator, Prometheus, and Grafana

13.3.1 Configuring metrics with Spring Boot Actuator and Micrometer

13.3.2 Monitoring metrics with Prometheus and Grafana

13.3.3 Configuring Prometheus metrics in Kubernetes

13.4 Distributed tracing with OpenTelemetry and Tempo

13.4.1 Managing traces with Tempo and Grafana

13.4.2 Configuring tracing in Spring Boot with OpenTelemetry