To expose application metrics with Spring Boot Actuator, add spring-boot-starter-actuator to your project and list metrics in management.endpoints.web.exposure.include. Actuator then serves a JSON view of every metric at /actuator/metrics. For a monitoring system such as Prometheus, add the matching Micrometer registry and expose /actuator/prometheus.
Only health is exposed over HTTP by default, so the exposure setting is the step people most often miss. This guide covers Spring Boot 3.x configuration, reading metrics, filtering with tags, building a small custom metric and connecting an external tool.
The starter pulls in Actuator and Micrometer, the metrics library behind it.
Maven:
Gradle:
Spring Boot manages the version, so you do not set one. With only this dependency, metrics are collected in memory and available through /actuator/metrics and JMX.
Configure exposure in application.properties or application.yml. Exposing a named list is safer than exposing everything:
The wildcard management.endpoints.web.exposure.include=* exposes all endpoints and is acceptable only on a locked-down management port. If you need to remove one endpoint from a wildcard, use management.endpoints.web.exposure.exclude.
Since Spring Boot 3.4 you can also set per-endpoint access with management.endpoint.<id>.access (for example none, read-only or unrestricted), which replaces the older enabled property.
Run the app and request the list of metric names:
Ask for one metric by name, and narrow it with tags:
The response includes measurements (such as COUNT, TOTAL_TIME, MAX) and availableTags, so you can see which tag values you can drill into.
| Metric | Meaning |
|---|---|
http.server.requests | Request count and latency by method, URI template, status |
jvm.memory.used | Heap and non-heap memory in bytes |
jvm.gc.pause | Garbage collection pause time |
jvm.threads.live | Live thread count |
process.cpu.usage | CPU used by the JVM process |
hikaricp.connections.active | Active database connections in the pool |
Inject MeterRegistry into any Spring bean. This controller counts sign-ups and records the time spent in a service call:
After sending a few POST requests, curl http://localhost:8080/actuator/metrics/app.signups reports the COUNT. Use stable, low-cardinality tag values, because every distinct tag combination creates a separate time series.
To let Prometheus scrape the app, add the registry and expose the endpoint:
Then point Prometheus at /actuator/prometheus with a scrape job, and build dashboards in Grafana from the stored series. Other systems such as Datadog, New Relic or an OpenTelemetry collector use their own Micrometer registry and are configured under the management.<system>.metrics.export properties.
Treat Actuator as an internal interface:
management.server.port=9090 and keep that port off the public network.*.This leaves health open for load balancers and requires the MONITOR role for everything else.
/actuator/metrics?The endpoint is not exposed. Add metrics to management.endpoints.web.exposure.include, and check that management.endpoints.web.base-path has not changed the URL.
No. spring-boot-starter-actuator already includes it. You only add a registry dependency for an external backend.
Use the uri tag: /actuator/metrics/http.server.requests?tag=uri:/orders. The value is the URI template, such as /orders/{id}, not the raw path.
Yes. Use management.metrics.enable.<prefix>=false, for example management.metrics.enable.jvm=false, or a MeterFilter bean for finer control.
Add spring-boot-starter-actuator, expose metrics (and prometheus when using Prometheus) through management.endpoints.web.exposure.include, and read data at /actuator/metrics. Create custom meters with MeterRegistry, keep tag cardinality low, and secure the endpoints or move them to a private management port.