一键导入
logging-observability
Logging and observability patterns. MDC propagation, log levels, Micrometer metrics, distributed tracing, structured JSON logging.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Logging and observability patterns. MDC propagation, log levels, Micrometer metrics, distributed tracing, structured JSON logging.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Planning Mode skill for guided execution of large tasks. Provides structured task decomposition, user confirmation, per-task verification, retry logic, and quality summary.
Git 工作流 — 版本控制、提交规范、分支管理、.gitignore 治理
Structured bug diagnosis and repair workflow using the 5-Whys root cause analysis method. Ensures fixes include tests, documentation, and knowledge capture.
Generates structured documents including architecture diagrams (Mermaid), usage manuals, progress reports, and API documentation from code analysis.
Extracts reusable patterns and lessons from execution history and project experience. Generates structured knowledge entries for the knowledge base.
Evaluates project progress by analyzing workspace structure, code completeness, and comparing against planned milestones. Outputs structured progress reports.
| name | logging-observability |
| description | Logging and observability patterns. MDC propagation, log levels, Micrometer metrics, distributed tracing, structured JSON logging. |
| trigger | when configuring logging, adding metrics, tracing, or health checks |
| tags | ["logging","observability","metrics","tracing","micrometer","mdc"] |
| version | 2.0 |
| scope | platform |
| category | foundation |
Every log entry MUST include: traceId, correlationId, userId, requestId.
@Component
class MdcFilter : OncePerRequestFilter() {
override fun doFilterInternal(req: HttpServletRequest, res: HttpServletResponse, chain: FilterChain) {
val correlationId = req.getHeader("X-Correlation-Id") ?: UUID.randomUUID().toString()
MDC.put("correlationId", correlationId)
MDC.put("requestId", UUID.randomUUID().toString())
try { chain.doFilter(req, res) } finally { MDC.clear() }
}
}
MDC does NOT propagate to child threads — use MdcTaskDecorator for @Async and MDCContext() for coroutines.
| Level | Meaning | Example |
|---|---|---|
| ERROR | System broken, pager-worthy | Database connection lost |
| WARN | Degraded but functional | Retry succeeded, circuit breaker open |
| INFO | Normal business events | Order created, payment processed |
| DEBUG | Dev diagnostics (never in prod) | SQL queries, payloads |
snake_case names with units: order_processing_seconds, payment_totalservice, method, status/actuator/prometheusUse Micrometer Tracing with OpenTelemetry exporter. Trace context propagates automatically via W3C traceparent header.
Use LogstashEncoder in production for JSON output with MDC fields included.
System.out.println() — use SLF4J logger