Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/spring-projects/spring-boot/llms.txt

Use this file to discover all available pages before exploring further.

Spring Boot Actuator provides dependency management and auto-configuration for Micrometer, an application metrics facade that abstracts over more than a dozen monitoring systems. Adding a registry dependency to your classpath is all that is needed — Spring Boot auto-configures the MeterRegistry and begins collecting metrics from the JVM, HTTP layer, data sources, and other auto-detected components.

Supported monitoring systems

Prometheus polls your application by scraping the /actuator/prometheus endpoint. Add the registry dependency and expose the endpoint:
<dependency>
    <groupId>io.micrometer</groupId>
    <artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
management:
  endpoints:
    web:
      exposure:
        include: "prometheus"
Then add the following job to prometheus.yml:
scrape_configs:
- job_name: "spring"
  metrics_path: "/actuator/prometheus"
  static_configs:
  - targets: ["HOST:PORT"]
For ephemeral or batch jobs that cannot be scraped, add the Prometheus Pushgateway dependency and enable it:
<dependency>
    <groupId>io.prometheus</groupId>
    <artifactId>prometheus-metrics-exporter-pushgateway</artifactId>
</dependency>
management:
  prometheus:
    metrics:
      export:
        pushgateway:
          enabled: true
Datadog periodically pushes metrics to datadoghq.com. Provide your API key:
management:
  datadog:
    metrics:
      export:
        api-key: "YOUR_KEY"
        step: "30s"
Optionally, provide an application key to also export meter descriptions and types:
management:
  datadog:
    metrics:
      export:
        api-key: "YOUR_API_KEY"
        application-key: "YOUR_APPLICATION_KEY"
Exports to an InfluxDB v1 instance by default. For InfluxDB v2 configure org, bucket, and token:
management:
  influx:
    metrics:
      export:
        uri: "https://influx.example.com:8086"
management:
  graphite:
    metrics:
      export:
        host: "graphite.example.com"
        port: 9004
Exports metrics using the OpenTelemetry protocol to any OTLP-capable backend:
management:
  otlp:
    metrics:
      export:
        url: "https://otlp.example.com:4318/v1/metrics"
Custom headers for authentication can be added via management.otlp.metrics.export.headers.*.
SystemKey configuration property
AppOpticsmanagement.appoptics.metrics.export.api-token
Atlasmanagement.atlas.metrics.export.uri
Dynatracemanagement.dynatrace.metrics.export.uri and api-token
Elasticmanagement.elastic.metrics.export.host
Gangliamanagement.ganglia.metrics.export.host and port
Humiomanagement.humio.metrics.export.api-token
JMXmanagement.jmx.metrics.export.domain
KairosDBmanagement.kairos.metrics.export.uri
New Relicmanagement.newrelic.metrics.export.api-key and account-id
Stackdrivermanagement.stackdriver.metrics.export.project-id
StatsDmanagement.statsd.metrics.export.host and port
To disable a specific registry:
management:
  datadog:
    metrics:
      export:
        enabled: false
To disable all registries by default:
management:
  defaults:
    metrics:
      export:
        enabled: false

Auto-configured metrics

Spring Boot instruments many common technologies automatically. All metrics are published to every configured MeterRegistry.
JVM metrics are published under the jvm. meter name prefix and include:
  • Memory and buffer pool details
  • Garbage collection statistics
  • Thread utilization
  • Virtual thread statistics (requires io.micrometer:micrometer-java21)
  • Classes loaded and unloaded
  • JVM version information
  • JIT compilation time
Published under system., process., and disk. meter names:
  • CPU metrics
  • File descriptor metrics
  • Uptime metrics and absolute start time
  • Available disk space
All requests handled by Spring MVC, Spring WebFlux, and Jersey controllers produce metrics named http.server.requests by default. Customize the name with management.observations.http.server.requests.name.HTTP client metrics for RestTemplate, RestClient, and WebClient are published as http.client.requests. Use the auto-configured builders to get instrumentation automatically:
  • RestTemplateBuilder for RestTemplate
  • RestClient.Builder for RestClient
  • WebClient.Builder for WebClient
All DataSource beans are instrumented with gauges showing active, idle, maximum, and minimum connections. Hikari-specific metrics are published with the hikaricp prefix, tagged by pool name.Control the pool name with spring.datasource.name.
  • application.started.time — time taken to start the application
  • application.ready.time — time taken until the application is ready to serve requests
Both metrics are tagged with the fully qualified application class name.
ComponentMeter name prefix
Logback / Log4J2logback.events. / log4j2.events.
Caches (Caffeine, Redis, Hazelcast, JCache)cache
Kafka consumer/producerAuto-configured via MicrometerConsumerListener
MongoDB commandsmongodb.driver.commands
MongoDB connection poolmongodb.driver.pool.*
RabbitMQrabbitmq
Spring Integrationspring.integration.
Spring Data repositoriesspring.data.repository.invocations
Tomcattomcat. (requires server.tomcat.mbeanregistry.enabled=true)
SSL bundlesssl.chain.expiry

Registering custom metrics

Inject MeterRegistry directly into any Spring-managed component:
import io.micrometer.core.instrument.Counter;
import io.micrometer.core.instrument.MeterRegistry;
import org.springframework.stereotype.Component;

@Component
public class MyBean {

    private final Counter orderCounter;

    public MyBean(MeterRegistry registry) {
        this.orderCounter = Counter.builder("orders.created")
            .description("Number of orders created")
            .tag("region", "us-east-1")
            .register(registry);
    }

    public void createOrder() {
        // business logic ...
        this.orderCounter.increment();
    }

}
For metrics that depend on other beans, use MeterBinder to ensure correct dependency ordering:
import io.micrometer.core.instrument.Gauge;
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.binder.MeterBinder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyMeterBinderConfiguration {

    @Bean
    public MeterBinder queueSize(Queue queue) {
        return (registry) -> Gauge.builder("queueSize", queue::size)
            .register(registry);
    }

}
@Timed, @Counted, and @Observed annotation scanning is supported via AOP. Enable it with management.observations.annotations.enabled=true and a dependency on org.aspectj:aspectjweaver.

Customizing metrics

Common tags

Apply tags to all meters for environment-level dimensions like host, region, and stack:
management:
  metrics:
    tags:
      region: "us-east-1"
      stack: "prod"

Per-meter properties

Disable, filter, or configure histogram behavior for specific meter IDs:
management:
  metrics:
    enable:
      example:
        remote: false
    distribution:
      percentiles-histogram:
        http.server.requests: true
      percentiles:
        http.server.requests: 0.5, 0.95, 0.99
      slo:
        http.server.requests: 10ms, 50ms, 100ms, 200ms

Registry customizer

Apply global customizations before any meters are registered:
import io.micrometer.core.instrument.MeterRegistry;
import org.springframework.boot.actuate.autoconfigure.metrics.MeterRegistryCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyMeterRegistryConfiguration {

    @Bean
    public MeterRegistryCustomizer<MeterRegistry> metricsCommonTags() {
        return (registry) -> registry.config().commonTags("application", "my-app");
    }

}

The metrics endpoint

The /actuator/metrics endpoint lists all available meter names. Drill into a specific meter by name:
GET /actuator/metrics/jvm.memory.max
GET /actuator/metrics/jvm.memory.max?tag=area:nonheap
Use the meter’s Micrometer name (e.g., jvm.memory.max), not its monitoring-system-normalized form (e.g., jvm_memory_max in Prometheus), when querying the metrics endpoint.

Build docs developers (and LLMs) love