In modern production systems, observability is not just an option—it’s a necessity. Whether you're debugging performance issues or trying to monitor application health in real-time, Spring Boot Actuator and Micrometer are your go-to tools in the Spring Boot ecosystem.
Let’s break down what each of them does, how they work together, and why you should be using them.
🔧 What is Spring Boot Actuator?
Spring Boot Actuator brings production-ready features to your Spring Boot application. It provides a rich set of endpoints to help you monitor and manage your application via HTTP, JMX, or custom protocols.
✅ Key Features of Spring Boot Actuator
Endpoint | Description |
---|---|
/actuator/health |
Displays application health info (integrates with DB, disk space, etc.) |
/actuator/info |
Displays custom application info (from application.properties ) |
/actuator/metrics |
Shows application metrics collected by Micrometer |
/actuator/env |
Displays all environment properties (use with caution!) |
/actuator/beans |
Lists all Spring beans in the application context |
/actuator/mappings |
Shows all @RequestMapping URLs |
/actuator/configprops |
Lists all @ConfigurationProperties beans |
/actuator/loggers |
View and change log levels at runtime |
/actuator/threaddump |
Provides a JVM thread dump |
/actuator/httptrace |
Displays trace of recent HTTP requests |
/actuator/scheduledtasks |
Lists scheduled tasks in your app |
/actuator/auditevents |
Shows audit events (if enabled) |
/actuator/caches |
Shows details about caches |
/actuator/heapdump |
Allows downloading a heap dump (if JVM supports it) |
You can customize which endpoints are exposed using:
management:
endpoints:
web:
exposure:
include: health, info, metrics, httptrace
📊 What is Micrometer?
Micrometer is a metrics instrumentation facade that allows you to collect and export metrics from your Spring Boot application to popular monitoring systems like Prometheus, Datadog, New Relic, and more.
Micrometer is not an endpoint provider. Instead, it collects metrics and passes them to Spring Boot Actuator, which exposes them via /actuator/metrics
.
✅ Out-of-the-box Metrics by Micrometer
Metric Name | Description |
---|---|
jvm.memory.used |
Current memory usage of the JVM |
jvm.gc.pause |
Time taken by garbage collection |
jvm.threads.live |
Number of live threads |
jvm.classes.loaded |
Number of classes loaded into memory |
system.cpu.usage |
System-wide CPU usage |
process.cpu.usage |
CPU usage by your app process |
http.server.requests |
Count, duration, and status of HTTP requests |
logback.events |
Number of logs (info, warn, error) |
tomcat.sessions.active.current |
Number of active sessions |
executor.active |
Active threads in executors |
datasource.connections.active |
Active DB connections |
cache.gets , cache.puts
|
Cache access patterns |
🚀 Custom Metrics with Micrometer
You can register your own custom metrics using the MeterRegistry
bean.
@Autowired
private MeterRegistry meterRegistry;
@PostConstruct
public void initMetrics() {
meterRegistry.counter("custom.api.calls", "endpoint", "create-user").increment();
}
🧠 Actuator + Micrometer = Full Observability
When you combine both, you get:
- Real-time application health monitoring
- JVM, system, and process metrics
- Fine-grained metrics for HTTP requests, logs, GC, caches, and more
- Custom metrics integration
- Export support for Prometheus, Datadog, Graphite, New Relic, etc.
📦 Add to Your Project
In pom.xml
(for Maven):
org.springframework.boot
spring-boot-starter-actuator
io.micrometer
micrometer-registry-prometheus
✅ Conclusion
Tool | Purpose |
---|---|
Spring Boot Actuator | Exposes endpoints to monitor and manage the app |
Micrometer | Collects metrics and integrates with monitoring systems |
Together, these tools bring production-grade observability to your Spring Boot applications with minimal setup. Whether you're debugging an issue, scaling your app, or just keeping an eye on performance, Actuator + Micrometer is a powerhouse duo.
💬 Have you used these tools in production? Share your experience in the comments below!