Skip to content

github/awesome-copilot / skills/spring-observability

spring-observability

Verified

Add and review observability in Spring Boot 3/4 apps: Actuator exposure and health probes, Micrometer metrics, Observation API, OpenTelemetry tracing and OTLP/Prometheus export, structured logging with correlation ids, and safe use of heapdump/threaddump. Use when instrumenting, monitoring or troubleshooting a Spring Boot service.

FileKindSize
SKILL.mdskill md3.7 KB
references/actuator.mdmarkdown1.9 KB
references/dumps-and-diagnostics.mdmarkdown1.4 KB
references/logging.mdmarkdown1.7 KB
references/metrics.mdmarkdown2.0 KB
references/tracing-observation.mdmarkdown2.7 KB

references/logging.md

View on GitHub
# Logging

## Structured logging (Boot 3.4+)

Built in; no extra dependency for ECS, Logstash and GELF formats.

```yaml
logging:
  structured:
    format:
      console: ecs        # also: logstash, gelf
      file: ecs
    ecs:
      service:
        name: orders
        version: 1.4.0
        environment: prod
```

- Customize JSON with `logging.structured.json.include/exclude/rename/add.*`. For code-based customization, implement `StructuredLoggingJsonMembersCustomizer` and register its fully qualified class name with `logging.structured.json.customizer`, or list the implementation under `org.springframework.boot.logging.structured.StructuredLoggingJsonMembersCustomizer` in `META-INF/spring.factories`. A Spring `@Bean` alone is not discovered: logging initializes before the application context.
- Custom format: implement `StructuredLogFormatter<E>` and set `logging.structured.format.console` to its class name.
- Use plain text locally and JSON in production profiles (`application-prod.yml`).
- Stack trace shaping: `logging.structured.json.stacktrace.*`.

## Correlation ids

- With tracing on the classpath, `traceId` and `spanId` are put in the MDC and appear in the default log pattern and in structured output.
- Without tracing, set a correlation id yourself (servlet filter putting a header value into `MDC`, cleared in `finally`).
- Customize the pattern: `logging.pattern.correlation=[%X{traceId:-},%X{spanId:-}] `; include with `logging.include-application-name`/`logging.include-application-group` (Boot 3.4+).
- Propagate the id to downstream calls (automatic for tracing-enabled clients).

## Practices

- Never log secrets, tokens, passwords, or full personal data.
- Change levels at runtime only via a secured `loggers` endpoint.
receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementationStars: 319kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 319kUpdated Claude CodeCodexVerifiedInstall
using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallbackStars: 319kUpdated Claude CodeCodexVerifiedInstall
verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions alwaysStars: 319kUpdated Claude CodeCodexVerifiedInstall