Agent-skills-standard spring-boot-observability
Instrument Spring Boot with Micrometer metrics, distributed tracing, and structured logging. Use when adding Micrometer metrics, distributed tracing, or structured logging to Spring Boot. (triggers: logback-spring.xml, application.properties, micrometer, tracing, correlation-id, mdc)
install
source · Clone the upstream repo
git clone https://github.com/HoangNguyen0403/agent-skills-standard
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/HoangNguyen0403/agent-skills-standard "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/spring-boot/spring-boot-observability" ~/.claude/skills/hoangnguyen0403-agent-skills-standard-spring-boot-observability && rm -rf "$T"
manifest:
skills/spring-boot/spring-boot-observability/SKILL.mdsource content
Spring Boot Observability
Priority: P0
Implementation Workflow
- Add tracing and metrics dependencies to
pom.xml - Configure
for tracing, actuator, and log correlationapplication.yaml - Add structured logging with MDC context
- Verify with
and check trace IDs in logscurl localhost:8080/actuator/prometheus
Enable Distributed Tracing
- Correlation IDs: Enable trace/span ID injection.
- Propagation: Propagate context across threads (
) and clients.@Async - OpenTelemetry: Use OTel bridge (
).micrometer-tracing-bridge-otel
See implementation examples for application.yaml tracing configuration and actuator exposure.
Configure Structured Logging
- Format: Use JSON logging (
) in production.logstash-logback-encoder - MDC: Use MDC for contextual info (userId, tenantId). Always clear MDC in finally block.
- Output: Log to stdout only. Let container handle shipping.
See implementation examples for structured logging with MDC context and Logstash encoder.
Secure Actuator Endpoints
- Security: Secure
with Admin role./actuator/** - Probes: Enable K8s Liveness/Readiness probes.
- Verify: Run
to confirm metrics exposed.curl localhost:8080/actuator/prometheus
Anti-Patterns
- No System.out: Use @Slf4j for all structured logging.
- No open Actuator: Secure /actuator/** with Admin role.
- No DIY tracing: Use Micrometer with OTel bridge.