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:
- β Configure Spring Boot Actuator
- β Use monitoring endpoints
- β Create custom health checks
- β Collect and expose metrics
- β 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β
| Type | Duration |
|---|---|
| Theory | 3h (4 chapters) |
| Practice | 3h (2 Labs) |
| Total | 6h (~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β
Recommended Progressionβ
- Chapter 1 β Install and configure Actuator
- Chapter 2 β Explore the endpoints
- Lab 11.1 β Practice configuration
- Chapters 3-4 β Metrics and Health
- Lab 11.2 β Complete Prometheus/Grafana stack
β Self-Assessmentβ
Before starting, answer:
- Do you know what Spring Boot Actuator is? β Yes β No
- Are you familiar with Prometheus? β Yes β No
- Have you ever used Grafana? β Yes β No
- 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