Spring Boot Actuator Skill
Overview
- Deliver production-ready observability for Spring Boot services using Actuator endpoints, probes, and Micrometer integration.
- Standardize health, metrics, and diagnostics configuration while delegating deep reference material to
references/.
- Support platform requirements for secure operations, SLO reporting, and incident diagnostics.
When to Use
- Trigger: "enable actuator endpoints" – Bootstrap Actuator for a new or existing Spring Boot service.
- Trigger: "secure management port" – Apply Spring Security policies to protect management traffic.
- Trigger: "configure health probes" – Define readiness and liveness groups for orchestrators.
- Trigger: "export metrics to prometheus" – Wire Micrometer registries and tune metric exposure.
- Trigger: "debug actuator startup" – Inspect condition evaluations and startup metrics when endpoints are missing or slow.
Quick Start
- Add the starter dependency.
<!-- Maven -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
// Gradle
dependencies {
implementation "org.springframework.boot:spring-boot-starter-actuator"
}
- Restart the service and verify
/actuator/health and /actuator/info respond with 200 OK.
Implementation Workflow
1. Expose the required endpoints
- Set
management.endpoints.web.exposure.include to the precise list or "*" for internal deployments.
- Adjust
management.endpoints.web.base-path (e.g., /management) when the default /actuator conflicts with routing.
- Review detailed endpoint semantics in
references/endpoint-reference.md.
2. Secure management traffic
- Apply an isolated
SecurityFilterChain using EndpointRequest.toAnyEndpoint() with role-based rules.
- Combine
management.server.port with firewall controls or service mesh policies for operator-only access.
- Keep
/actuator/health/** publicly accessible only when required; otherwise enforce authentication.
3. Configure health probes
- Enable
management.endpoint.health.probes.enabled=true for /health/liveness and /health/readiness.
- Group indicators via
management.endpoint.health.group.* to match platform expectations.
- Implement custom indicators by extending
HealthIndicator or ReactiveHealthContributor; sample implementations live in references/examples.md#custom-health-indicator.
4. Publish metrics and traces
- Activate Micrometer exporters (Prometheus, OTLP, Wavefront, StatsD) via
management.metrics.export.*.
- Apply
MeterRegistryCustomizer beans to add application, environment, and business tags for observability correlation.
- Surface HTTP request metrics with
server.observation.* configuration when using Spring Boot 3.2+.
5. Enable diagnostics tooling
- Turn on
/actuator/startup (Spring Boot 3.5+) and /actuator/conditions during incident response to inspect auto-configuration decisions.
- Register an
HttpExchangeRepository (e.g., InMemoryHttpExchangeRepository) before enabling /actuator/httpexchanges for request auditing.
- Consult
references/official-actuator-docs.md for endpoint behaviors and limits.
Examples
Basic – Expose health and info safely
management:
endpoints:
web:
exposure:
include: "health,info"
endpoint:
health:
show-details: never
Intermediate – Readiness group with custom indicator
@Component
public class PaymentsGatewayHealth implements HealthIndicator {
private final PaymentsClient client;
public PaymentsGatewayHealth(PaymentsClient client) {
this.client = client;
}
@Override
public Health health() {
boolean reachable = client.ping();
return reachable ? Health.up().withDetail("latencyMs", client.latency()).build()
: Health.down().withDetail("error", "Gateway timeout").build();
}
}
management:
endpoint:
health:
probes:
enabled: true
group:
readiness:
include: "readinessState,db,paymentsGateway"
show-details: always
Advanced – Dedicated management port with Prometheus export
management:
server:
port: 9091
ssl:
enabled: true
endpoints:
web:
exposure:
include: "health,info,metrics,prometheus"
base-path: "/management"
metrics:
export:
prometheus:
descriptions: true
step: 30s
endpoint:
health:
show-details: when-authorized
roles: "ENDPOINT_ADMIN"
@Configuration
public class ActuatorSecurityConfig {
@Bean
SecurityFilterChain actuatorChain(HttpSecurity http) throws Exception {
http.securityMatcher(EndpointRequest.toAnyEndpoint())
.authorizeHttpRequests(c -> c
.requestMatchers(EndpointRequest.to("health")).permitAll()
.anyRequest().hasRole("ENDPOINT_ADMIN"))
.httpBasic(Customizer.withDefaults());
return http.build();
}
}
More end-to-end samples are available in references/examples.md.
Best Practices
- Keep SKILL.md concise and rely on
references/ for verbose documentation to conserve context.
- Apply the principle of least privilege: expose only required endpoints and restrict sensitive ones.
- Use immutable configuration via profile-specific YAML to align environments.
- Monitor actuator traffic separately to detect scraping abuse or brute-force attempts.
- Automate regression checks by scripting
curl probes in CI/CD pipelines.
Constraints
- Avoid exposing
/actuator/env, /actuator/configprops, /actuator/logfile, and /actuator/heapdump on public networks.
- Do not ship custom health indicators that block event loop threads or exceed 250 ms unless absolutely necessary.
- Ensure Actuator metrics exporters run on supported Micrometer registries; unsupported exporters require custom registry beans.
- Maintain compatibility with Spring Boot 3.5.x conventions; older versions may lack probes and observation features.
Reference Materials
- Endpoint quick reference
- Implementation examples
- Official documentation extract
- Auditing with Actuator
- Cloud Foundry integration
- Enabling Actuator features
- HTTP exchange recording
- JMX exposure
- Monitoring and metrics
- Logging configuration
- Metrics exporters
- Observability with Micrometer
- Process and Monitoring
- Tracing
- Scripts directory (
scripts/) reserved for future automation; no runtime dependencies today.
Validation Checklist
- Confirm
mvn spring-boot:run or ./gradlew bootRun exposes expected endpoints under /actuator (or custom base path).
- Verify
/actuator/health/readiness returns UP with all mandatory components before promoting to production.
- Scrape
/actuator/metrics or /actuator/prometheus to ensure required meters (http.server.requests, jvm.memory.used) are present.
- Run security scans to validate only intended ports and endpoints are reachable from outside the trusted network.
1---2name: spring-boot-actuator-23description: Configure Spring Boot Actuator for production-grade monitoring, health probes, secured management endpoints, and Micrometer metrics across JVM services.4---56# Spring Boot Actuator Skill78## Overview9- Deliver production-ready observability for Spring Boot services using Actuator endpoints, probes, and Micrometer integration.10- Standardize health, metrics, and diagnostics configuration while delegating deep reference material to `references/`.11- Support platform requirements for secure operations, SLO reporting, and incident diagnostics.1213## When to Use14- Trigger: "enable actuator endpoints" – Bootstrap Actuator for a new or existing Spring Boot service.15- Trigger: "secure management port" – Apply Spring Security policies to protect management traffic.16- Trigger: "configure health probes" – Define readiness and liveness groups for orchestrators.17- Trigger: "export metrics to prometheus" – Wire Micrometer registries and tune metric exposure.18- Trigger: "debug actuator startup" – Inspect condition evaluations and startup metrics when endpoints are missing or slow.1920## Quick Start211. Add the starter dependency.22 ```xml23 <!-- Maven -->24 <dependency>25 <groupId>org.springframework.boot</groupId>26 <artifactId>spring-boot-starter-actuator</artifactId>27 </dependency>28 ```29 ```gradle30 // Gradle31 dependencies {32 implementation "org.springframework.boot:spring-boot-starter-actuator"33 }34 ```352. Restart the service and verify `/actuator/health` and `/actuator/info` respond with `200 OK`.3637## Implementation Workflow3839### 1. Expose the required endpoints40- Set `management.endpoints.web.exposure.include` to the precise list or `"*"` for internal deployments.41- Adjust `management.endpoints.web.base-path` (e.g., `/management`) when the default `/actuator` conflicts with routing.42- Review detailed endpoint semantics in `references/endpoint-reference.md`.4344### 2. Secure management traffic45- Apply an isolated `SecurityFilterChain` using `EndpointRequest.toAnyEndpoint()` with role-based rules.46- Combine `management.server.port` with firewall controls or service mesh policies for operator-only access.47- Keep `/actuator/health/**` publicly accessible only when required; otherwise enforce authentication.4849### 3. Configure health probes50- Enable `management.endpoint.health.probes.enabled=true` for `/health/liveness` and `/health/readiness`.51- Group indicators via `management.endpoint.health.group.*` to match platform expectations.52- Implement custom indicators by extending `HealthIndicator` or `ReactiveHealthContributor`; sample implementations live in `references/examples.md#custom-health-indicator`.5354### 4. Publish metrics and traces55- Activate Micrometer exporters (Prometheus, OTLP, Wavefront, StatsD) via `management.metrics.export.*`.56- Apply `MeterRegistryCustomizer` beans to add `application`, `environment`, and business tags for observability correlation.57- Surface HTTP request metrics with `server.observation.*` configuration when using Spring Boot 3.2+.5859### 5. Enable diagnostics tooling60- Turn on `/actuator/startup` (Spring Boot 3.5+) and `/actuator/conditions` during incident response to inspect auto-configuration decisions.61- Register an `HttpExchangeRepository` (e.g., `InMemoryHttpExchangeRepository`) before enabling `/actuator/httpexchanges` for request auditing.62- Consult `references/official-actuator-docs.md` for endpoint behaviors and limits.6364## Examples6566### Basic – Expose health and info safely67```yaml68management:69 endpoints:70 web:71 exposure:72 include: "health,info"73 endpoint:74 health:75 show-details: never76```7778### Intermediate – Readiness group with custom indicator79```java80@Component81public class PaymentsGatewayHealth implements HealthIndicator {8283 private final PaymentsClient client;8485 public PaymentsGatewayHealth(PaymentsClient client) {86 this.client = client;87 }8889 @Override90 public Health health() {91 boolean reachable = client.ping();92 return reachable ? Health.up().withDetail("latencyMs", client.latency()).build()93 : Health.down().withDetail("error", "Gateway timeout").build();94 }95}96```97```yaml98management:99 endpoint:100 health:101 probes:102 enabled: true103 group:104 readiness:105 include: "readinessState,db,paymentsGateway"106 show-details: always107```108109### Advanced – Dedicated management port with Prometheus export110```yaml111management:112 server:113 port: 9091114 ssl:115 enabled: true116 endpoints:117 web:118 exposure:119 include: "health,info,metrics,prometheus"120 base-path: "/management"121 metrics:122 export:123 prometheus:124 descriptions: true125 step: 30s126 endpoint:127 health:128 show-details: when-authorized129 roles: "ENDPOINT_ADMIN"130```131```java132@Configuration133public class ActuatorSecurityConfig {134135 @Bean136 SecurityFilterChain actuatorChain(HttpSecurity http) throws Exception {137 http.securityMatcher(EndpointRequest.toAnyEndpoint())138 .authorizeHttpRequests(c -> c139 .requestMatchers(EndpointRequest.to("health")).permitAll()140 .anyRequest().hasRole("ENDPOINT_ADMIN"))141 .httpBasic(Customizer.withDefaults());142 return http.build();143 }144}145```146147More end-to-end samples are available in `references/examples.md`.148149## Best Practices150- Keep SKILL.md concise and rely on `references/` for verbose documentation to conserve context.151- Apply the principle of least privilege: expose only required endpoints and restrict sensitive ones.152- Use immutable configuration via profile-specific YAML to align environments.153- Monitor actuator traffic separately to detect scraping abuse or brute-force attempts.154- Automate regression checks by scripting `curl` probes in CI/CD pipelines.155156## Constraints157- Avoid exposing `/actuator/env`, `/actuator/configprops`, `/actuator/logfile`, and `/actuator/heapdump` on public networks.158- Do not ship custom health indicators that block event loop threads or exceed 250 ms unless absolutely necessary.159- Ensure Actuator metrics exporters run on supported Micrometer registries; unsupported exporters require custom registry beans.160- Maintain compatibility with Spring Boot 3.5.x conventions; older versions may lack probes and observation features.161162## Reference Materials163- [Endpoint quick reference](references/endpoint-reference.md)164- [Implementation examples](references/examples.md)165- [Official documentation extract](references/official-actuator-docs.md)166- [Auditing with Actuator](references/auditing.md)167- [Cloud Foundry integration](references/cloud-foundry.md)168- [Enabling Actuator features](references/enabling.md)169- [HTTP exchange recording](references/http-exchanges.md)170- [JMX exposure](references/jmx.md)171- [Monitoring and metrics](references/monitoring.md)172- [Logging configuration](references/loggers.md)173- [Metrics exporters](references/metrics.md)174- [Observability with Micrometer](references/observability.md)175- [Process and Monitoring](references/process-monitoring.md)176- [Tracing](references/tracing.md)177- Scripts directory (`scripts/`) reserved for future automation; no runtime dependencies today.178179## Validation Checklist180- Confirm `mvn spring-boot:run` or `./gradlew bootRun` exposes expected endpoints under `/actuator` (or custom base path).181- Verify `/actuator/health/readiness` returns `UP` with all mandatory components before promoting to production.182- Scrape `/actuator/metrics` or `/actuator/prometheus` to ensure required meters (`http.server.requests`, `jvm.memory.used`) are present.183- Run security scans to validate only intended ports and endpoints are reachable from outside the trusted network.184