Micrometer is the metrics and observability facade that Spring Boot uses for application monitoring. You write metrics once against the Micrometer API, and it exports them to the monitoring system you choose, such as Prometheus, Datadog, InfluxDB or OTLP. Spring Boot Actuator auto-configures it, so HTTP requests, JVM memory, garbage collection, thread pools and data source connections are measured without any code.
Think of Micrometer as SLF4J for metrics: your code depends on one vendor-neutral API, and the backend is a dependency you can swap. Since Spring Boot 3 it also provides the Observation API, which produces metrics and distributed traces from a single instrumentation point.
Spring Boot Actuator depends on Micrometer and registers a MeterRegistry bean. Everything you measure goes through it. Each metric is a meter with a name, a type and optional tags (dimensions such as uri or status).
| Meter type | Use it for | Example |
|---|---|---|
Counter | A value that only goes up | Orders placed |
Gauge | A value that goes up and down | Items in a queue |
Timer | Duration and count of short events | Payment call latency |
DistributionSummary | Distribution of non-time values | Response payload size |
LongTaskTimer | Operations that are still running | Report generation jobs |
Add Actuator and the registry for your backend. For Prometheus with Maven:
Then expose the endpoints in application.yml:
Start the application and open /actuator/metrics to list meters, or /actuator/prometheus to see the scrape format that Prometheus reads. The management.metrics.tags.* property adds a common tag to every metric, which helps when many services share one dashboard. Spring Boot 3 and later names the dependency set the same way, though a newer Boot line may adjust the Prometheus client version, so check the Spring Boot reference for the one you use.
Inject MeterRegistry and create meters. Counters and timers are cached by name and tags, so creating them repeatedly is safe, but keeping them in fields is cheaper.
For method-level timing without boilerplate, enable @Timed and @Counted by registering the TimedAspect and CountedAspect beans and adding spring-boot-starter-aop (or the AspectJ dependency your Boot version expects).
In the Prometheus output, the counter appears as orders_placed_total and the timer as orders_payment_duration_seconds_count, _sum and _bucket series. Micrometer converts dotted names to the naming convention of each backend.
With Actuator on the classpath, Spring Boot binds many meters automatically:
http.server.requests, tagged with method, URI template, status and outcome.http.client.requests when you build clients from the auto-configured RestClient.Builder, RestTemplateBuilder or WebClient.Builder.Because the uri tag uses the route template (for example /orders/{id}) rather than the raw path, the number of distinct time series stays bounded.
Spring Boot 3 introduced the Observation API on top of Micrometer. You wrap an operation in an Observation, and registered handlers turn it into a timer, a trace span, or both.
Add a tracing bridge (Micrometer Tracing with OpenTelemetry or Brave) and the same observation shows up as a span in your tracing backend.
orders.placed, and put the unit in the base unit (seconds, bytes) when you can.SimpleMeterRegistry in unit tests.No. Actuator provides production endpoints such as health and metrics, and uses Micrometer as its metrics engine. Micrometer is a separate library that also works outside Spring.
It supports many, including Prometheus, Datadog, New Relic, InfluxDB, Graphite, CloudWatch and OpenTelemetry (OTLP). Each has its own registry dependency, and you can add several at once.
Add micrometer-registry-prometheus, expose the prometheus endpoint, and point a Prometheus scrape job at /actuator/prometheus.
No, but with Micrometer Tracing and the Observation API one instrumentation point can feed both metrics and traces.
Micrometer gives Spring Boot a vendor-neutral way to record counters, gauges, timers and distributions, and Actuator wires up a large set of useful meters automatically. Add the registry for your monitoring system, expose the endpoint, record custom meters through MeterRegistry, and keep tags low-cardinality. For configuration details, see the Spring Boot metrics documentation.