Skip to main content

MODULE 11 - Spring Boot Actuator and Monitoring

Welcome to Module 11! πŸ“Šβ€‹

Your application is in production... but how do you know if it's working properly? Is it slow? Is it running out of memory? Spring Boot Actuator gives you the eyes to monitor your application.


πŸŽ“ Learning Objectives​

By the end of this module, you will be able to:

  1. βœ… Configure Spring Boot Actuator
  2. βœ… Use monitoring endpoints
  3. βœ… Create custom health checks
  4. βœ… Collect and expose metrics
  5. βœ… Integrate Prometheus and Grafana

πŸ“š Prerequisites​

Before starting this module, you should have:

  • βœ… Completed Modules 1 to 10
  • βœ… Understand the basics of HTTP
  • βœ… Docker installed (for Prometheus/Grafana)
  • βœ… Knowledge of basic monitoring concepts

πŸ—ΊοΈ Module Outline​

Theoretical Part (4 chapters)​

Chapter 1: Introduction to Actuator​

Duration: 30 minutes

Content:

  • What is Actuator?
  • Installation and configuration
  • Endpoint security
  • Getting started

Why important? Understand the basic tool


Chapter 2: The Endpoints​

Duration: 45 minutes

Content:

  • /health, /info, /env
  • /beans, /mappings, /conditions
  • /loggers, /heapdump, /threaddump
  • Custom endpoints

Why important? Diagnose your application


Chapter 3: Metrics with Micrometer​

Duration: 1 hour

Content:

  • Micrometer and registries
  • Counter, Gauge, Timer, Summary
  • JVM, HTTP, Database metrics
  • Custom metrics
  • Tags and dimensions

Why important? Measure performance


Chapter 4: Health Checks​

Duration: 45 minutes

Content:

  • Native Health Indicators
  • Custom health checks
  • Health groups
  • Liveness vs Readiness (Kubernetes)

Why important? Detect issues


Practical Part (2 Labs)​

Lab 11.1: Actuator Configuration​

Duration: 1h30

Objective: Configure Actuator for an application

You will:

  • Enable and secure endpoints
  • Create custom health checks
  • Add application information
  • Test all endpoints

Lab 11.2: Monitoring with Prometheus & Grafana​

Duration: 1h30

Objective: Set up a complete monitoring stack

You will:

  • Configure Prometheus
  • Create Grafana dashboards
  • Add business metrics
  • Set up alerts

πŸ“Š Total Duration​

TypeDuration
Theory3h (4 chapters)
Practice3h (2 Labs)
Total6h (~2 sessions)

🎯 What You Will Understand​

Before this Module​

// Application in production... 🀞
// "Is it working?"
// "I don't know, users aren't complaining..."
// "How much memory are we using?"
// "No idea..."

After this Module​

# Check health
curl http://localhost:8080/actuator/health
{
"status": "UP",
"components": {
"db": { "status": "UP" },
"diskSpace": { "status": "UP" },
"redis": { "status": "UP" }
}
}

# View metrics
curl http://localhost:8080/actuator/metrics/http.server.requests
{
"name": "http.server.requests",
"measurements": [
{ "statistic": "COUNT", "value": 1523 },
{ "statistic": "TOTAL_TIME", "value": 45.2 }
]
}

Grafana Dashboard:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ πŸ“Š Application Dashboard β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Requests/sec β”‚ Latency P99 β”‚ Error Rate β”‚
β”‚ 125 β”‚ 45ms β”‚ 0.1% β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ [Graph: Request Rate over Time] β”‚
β”‚ [Graph: JVM Memory Usage] β”‚
β”‚ [Graph: Database Connection Pool] β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Why This Module is Essential​

1. Production Visibility​

Without Actuator:
- "The application is slow" β†’ Why?
- "It's not working anymore" β†’ Since when? What changed?
- "We have a memory issue" β†’ Really?

With Actuator:
- Real-time metrics
- Performance history
- Proactive alerts

2. DevOps and SRE​

Kubernetes Health Probes:
livenessProbe:
httpGet:
path: /actuator/health/liveness
readinessProbe:
httpGet:
path: /actuator/health/readiness

β†’ Automatic restart if the app is dead
β†’ Traffic cut off if the app is not ready

3. Sought-After Skill​

Job offers:
βœ“ "Experience with Prometheus/Grafana"
βœ“ "Setting up monitoring"
βœ“ "Application observability"
βœ“ "Spring Boot Actuator"

πŸ—ΊοΈ Training Progression​

Module 11 = Observe your application in production!


πŸ“– How to Approach This Module​

  1. Chapter 1 β†’ Install and configure Actuator
  2. Chapter 2 β†’ Explore the endpoints
  3. Lab 11.1 β†’ Practice configuration
  4. Chapters 3-4 β†’ Metrics and Health
  5. Lab 11.2 β†’ Complete Prometheus/Grafana stack

βœ… Self-Assessment​

Before starting, answer:

  1. Do you know what Spring Boot Actuator is? ☐ Yes ☐ No
  2. Are you familiar with Prometheus? ☐ Yes ☐ No
  3. Have you ever used Grafana? ☐ Yes ☐ No
  4. Do you know what a health check is? ☐ Yes ☐ No

This module will make you an expert on all these topics!


🎯 Next Step​

Ready to make your application observable?

➑️ Start with Chapter 1: Introduction to Actuator


⬅️ Back to Course Outline