github/awesome-copilot / skills/spring-observability
spring-observability
VerifiedAdd 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.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 3.7 KB |
| references/actuator.md | markdown | 1.9 KB |
| references/dumps-and-diagnostics.md | markdown | 1.4 KB |
| references/logging.md | markdown | 1.7 KB |
| references/metrics.md | markdown | 2.0 KB |
| references/tracing-observation.md | markdown | 2.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.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| 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 implementation | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| 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 fallback | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| 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 always | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |