Micrometer is the metrics instrumentation library that Spring Boot uses for all of its application metrics. It provides a vendor-neutral API (counters, gauges, timers, distribution summaries) and ships adapters for backends such as Prometheus, Datadog, New Relic, CloudWatch and OpenTelemetry. Spring Boot Actuator auto-configures it, so you add a dependency and get JVM, HTTP and database metrics without writing code.
Micrometer has been the default metrics layer since Spring Boot 2.0 and it also powers observations (metrics plus tracing) in Spring Framework 6 and later.
Micrometer sits between your code and the monitoring system, much like SLF4J sits between your code and a logging backend. You record measurements through one API, and a MeterRegistry implementation translates them into the format your backend expects. Switching from Prometheus to Datadog means swapping a dependency and some properties, not rewriting instrumentation.
Spring Boot provides three things on top of Micrometer:
MeterRegistry for each registry dependency on the classpath./actuator/metrics endpoint and, for Prometheus, /actuator/prometheus.Add the Actuator starter and a registry dependency:
Expose the endpoints and add a common tag:
Start the application and open http://localhost:8080/actuator/prometheus. You will see metrics such as jvm_memory_used_bytes, http_server_requests_seconds_count and hikaricp_connections_active. Secure these endpoints in production, for example by serving them on a separate management port with management.server.port.
| Meter | Purpose | Example |
|---|---|---|
Counter | Monotonically increasing count | Orders placed, errors |
Gauge | Current value that rises and falls | Queue size, active sessions |
Timer | Count and duration of short events | Request or method latency |
LongTaskTimer | Duration of tasks still running | Batch jobs, report exports |
DistributionSummary | Distribution of non-time values | Payload size in bytes |
Each meter has a name and optional tags (key-value dimensions). Prefer dot-separated lowercase names such as orders.created; Micrometer converts them to the naming convention of each backend.
The timer is created once in the constructor. The counter uses a dynamic tag, so it is looked up by register, which returns the existing meter if the name and tags match. Keep tag values to a small, fixed set.
For simple cases, @Timed records method duration. It requires registering a TimedAspect bean and having Spring AOP available:
Spring Boot 3 also introduced the Observation API. One Observation can produce both a timer and a tracing span, which suits services that need metrics and distributed tracing:
Spring MVC, RestClient, WebClient and Spring Data already emit observations, so enabling a tracing bridge adds spans to them with no extra code.
The Actuator endpoint supports tag filtering:
You can also disable or tune meters by property, for example to cut cost on a backend that bills per series:
Micrometer is a separate project, but Spring Boot depends on it through Actuator and configures it automatically. You usually only add the registry for your backend.
No. Without a registry dependency, Spring Boot uses an in-memory registry, so /actuator/metrics still works. A backend registry is only needed to ship metrics elsewhere.
Micrometer collects and formats metrics. Actuator exposes operational endpoints (health, metrics, info) and wires Micrometer into Spring Boot.
Do not use unbounded values such as user IDs or raw URLs as tag values. Each unique tag combination creates a new series and raises storage cost.
Micrometer is the metrics facade behind Spring Boot Actuator. Add Actuator and a registry dependency, expose the endpoints, and you get JVM, web and database metrics at once. Use MeterRegistry to add counters, gauges and timers of your own, keep tags low-cardinality, and consider the Observation API when you also need tracing.