Actuator turns your application into something operators and dashboards can inspect. It ships health checks, metrics, environment details, and more behind a consistent set of HTTP endpoints.
Expose what you need
By default only /health is exposed over HTTP. Opt in to the endpoints you want
explicitly — never expose everything in production.
management.endpoints.web.exposure.include=health,info,metrics,prometheus
management.endpoint.health.show-details=when_authorized
management.metrics.tags.application=orders-serviceCustom health indicators
Add domain-specific checks so /health reflects real dependencies, not just the
process being alive.
@Component
public class QueueHealthIndicator implements HealthIndicator {
@Override
public Health health() {
int depth = queue.pendingCount();
return depth < 1000
? Health.up().withDetail("depth", depth).build()
: Health.down().withDetail("depth", depth).build();
}
}Metrics with Micrometer
Micrometer is Actuator's metrics facade. Register counters and timers, and they flow to Prometheus, Datadog, or whatever backend you configure.
@Service
public class OrderMetrics {
private final Counter placed;
public OrderMetrics(MeterRegistry registry) {
this.placed = registry.counter("orders.placed");
}
public void recordPlaced() {
placed.increment();
}
}Takeaways
- Expose only the endpoints you actually need, and secure them.
- Write custom health indicators for critical dependencies.
- Use Micrometer counters and timers to make business events measurable.
Pair Actuator with a Prometheus scrape and a Grafana dashboard, and you get real-time visibility for almost no code.