spring-observability

Configure structured logging, tracing, and metrics for Spring Boot 4.x services.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/dprice-dev/claude-java-skills --skill spring-observability
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: spring-observability
Source: https://github.com/dprice-dev/claude-java-skills/tree/main/.claude/skills/spring-observability
Command: npx skills add https://github.com/dprice-dev/claude-java-skills --skill spring-observability

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Spring services often ship with unclear logs, missing trace context, and metrics that don’t answer real operational questions; this Skill adds consistent observability so issues can be diagnosed quickly and reliably.

Core Features & Use Cases

  • Structured logging with correlation context: Logback JSON or console output with MDC keys (e.g., traceId, spanId, userId, requestId) so every event can be tied to a request across threads.
  • Distributed tracing and method-level spans: OpenTelemetry-based instrumentation plus Micrometer tracing/bridge patterns using @Observed to capture timing and contextual metadata.
  • Metrics and actuator visibility: Micrometer counters/timers/gauges and Actuator endpoint configuration for health, metrics, Prometheus scraping, and log level controls.
  • Use case: When an order API fails intermittently, enable this Skill to correlate request logs with trace IDs, time critical methods, expose Prometheus metrics, and add health indicators that pinpoint failing dependencies.

Quick Start

Enable spring-observability in your Spring Boot 4.x service by adding the stated observability dependencies and wiring MDC correlation, @Observed tracing, and Micrometer/Actuator metrics as shown in the skill instructions.

Frequently Asked Questions about spring-observability

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add distributed tracing and correlation IDs to a Spring Boot REST service?▼

Distributed tracing and correlation IDs are added to a Spring Boot REST service by configuring Logback JSON formatting, MDC propagation for trace context, and @Observed annotations to capture method-level spans via Micrometer and OpenTelemetry.

What is the best way to expose Spring Boot application metrics for Prometheus scraping?▼

Exposing Spring Boot application metrics for Prometheus scraping involves configuring Micrometer counters, timers, and gauges alongside Actuator endpoint settings to enable health checks, metric collection, and log level controls.

Does this observability configuration work with Spring Boot 4.x?▼

Yes, this observability configuration targets Spring Boot 4.x specifically, utilizing Micrometer tracing bridges and OpenTelemetry instrumentation to ensure runtime behavior remains observable and debuggable in that environment.

How do I format Spring Boot logs as JSON with MDC trace context?▼

Spring Boot logs are formatted as JSON with MDC trace context by applying Logback configuration that structures output and propagates MDC keys like traceId, spanId, and requestId across threads for every event.

Why are my Spring Boot service logs missing trace context when diagnosing intermittent failures?▼

Spring Boot service logs miss trace context when MDC propagation and structured logging are not configured, preventing correlation of request logs with trace IDs needed to pinpoint failing dependencies during intermittent API failures.

Can I use @Observed annotations to capture method-level timing in Spring Boot?▼

Yes, you can use @Observed annotations to capture method-level timing in Spring Boot, leveraging the Micrometer tracing bridge and OpenTelemetry integration to record contextual metadata and span timing for critical methods.