feat(observability): U12 可观测底座(ACM2-10 U12/R05/N31b)

- logback:logstash 通道先加 AsyncAppender(queueSize 4096、neverBlock、discardingThreshold 0)
  ——logstash 不可达不阻塞业务线程(N31b 顺序约束:先降级再补日志);MDC 增加 traceId/target
- 结构化日志 + MDC traceId(TraceLog.withTrace=cminmsgsId/eventId):
  InboxService 收报 INFO;MessageProcessor SUCCEEDED/SKIPPED INFO、FAILED/解码失败 WARN、
  DEAD(MALFORMED/毒丸/EXHAUSTED) ERROR;SnapshotFlow staging/CAS WARN、快照成功 INFO;
  Dispatcher 发送 DEBUG、逐条/整批重试 WARN、DEAD(DLQ) ERROR、flushSchd 批次 INFO;
  ReplayService 重放 INFO/非法类 WARN;PipelineLifecycle 起停 INFO
- 自定义健康指示器(infra/health):redis-flight-store / kafka-delivery——BeanProvider 可选解析,
  缺 bean(未 stub 也未实装)报 DOWN 而非启动失败;/health 聚合
- 保留:micrometer 队列深度/投递延迟 gauge 依赖版本选型(micronaut-micrometer 与平台 BOM 5.1.3
  对齐待锁),随数据层/真实 client 批次补;U13 毒丸超时告警与 DLQ 巡检入口仍属 WP2
This commit is contained in:
windyboy
2026-09-06 21:02:27 +08:00
parent f6da0cb782
commit 6de3fa6c9c
9 changed files with 130 additions and 13 deletions
@@ -20,6 +20,7 @@ class PipelineLifecycle(
private val pump: Pump,
private val dispatcher: Dispatcher,
) {
private val log = org.slf4j.LoggerFactory.getLogger(PipelineLifecycle::class.java)
private val threads = mutableListOf<Thread>()
@Volatile
@@ -35,6 +36,7 @@ class PipelineLifecycle(
started = true
threads += spawn("msgx-pump", pump::loop)
threads += spawn("msgx-dispatcher", dispatcher::loop)
log.info("pipeline loops started (pump, dispatcher)")
}
private fun spawn(name: String, body: () -> Unit): Thread =
@@ -46,5 +48,6 @@ class PipelineLifecycle(
dispatcher.stop()
threads.forEach { it.interrupt() } // 解除 Thread.sleep 阻塞,加速退出
threads.forEach { runCatching { it.join(3000) } }
log.info("pipeline loops stopped")
}
}