Custom Metrics with Micrometer
Record your own application metrics.
Micrometer: The Metrics Facade
Spring Boot uses Micrometer as a vendor-neutral metrics facade — the SLF4J of metrics. You instrument code against one API, then export to Prometheus, Datadog, CloudWatch, and others by adding a registry.
The MeterRegistry
The central component is the MeterRegistry. Boot auto-configures one and registers it as a bean, so you simply inject it wherever you need to record measurements.
@Service
public class OrderService {
private final MeterRegistry registry;
public OrderService(MeterRegistry registry) {
this.registry = registry;
}
}All lessons in this course
- Enabling Actuator Endpoints
- Health Indicators
- Custom Metrics with Micrometer
- Securing Actuator Endpoints