0PricingLogin
Spring Boot 4 Microservices & REST APIs · Lesson

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

  1. Enabling Actuator Endpoints
  2. Health Indicators
  3. Custom Metrics with Micrometer
  4. Securing Actuator Endpoints
← Back to Spring Boot 4 Microservices & REST APIs