feat: add diagnostics and telemetry runtime

This commit is contained in:
donghyeon-ka
2026-07-26 16:42:27 +09:00
parent 2fa0baa577
commit 5173b6c8d6
43 changed files with 1760 additions and 116 deletions
@@ -779,22 +779,31 @@ Logger와 telemetry는 같은 것이 아니다.
- Telemetry: registry에 정의된 semantic event와 metric
- Error reporter: 예외 집계와 release correlation
기본 `Logger` output port는 safe context만 받는다.
VD-07에 따라 기본 구현은 임의 message 문자열을 받는 `Logger`가 아니라 닫힌
event ID와 safe context만 받는 `DiagnosticsPort`다.
```ts
export interface Logger {
debug(message: string, context?: SafeLogContext): void;
info(message: string, context?: SafeLogContext): void;
warn(message: string, context?: SafeLogContext): void;
error(message: string, context?: SafeLogContext): void;
export interface DiagnosticsPort {
record(input: {
level: DiagnosticLevel;
eventId: DiagnosticEventId;
context?: DiagnosticContext;
}): void;
}
```
개발 환경에는 redacted console adapter, production에는 allowlist 기반
remote adapter, 테스트에는 recording 또는 no-op adapter를 연결한다.
기본 runtime에는 bounded in-memory diagnostics와 설정 기반 best-effort
telemetry adapter, 테스트에는 recording 또는 no-op adapter를 연결한다.
direct `console`은 redaction 경계를 우회하므로 source gate가 거절한다.
민감정보 redaction은 각 호출자의 선의가 아니라 adapter와 contract에서
강제한다.
현재 production producer는 boot, logical HTTP outcome, cache, storage, route,
render, release mismatch와 telemetry delivery drop을 포함한다. HTTP terminal
telemetry는 모든 retry가 끝난 뒤 한 번만 발행하며 abort에는 발행하지 않는다.
raw path/query/body/error 대신 route/operation/correlation ID와
status/attempt/duration bucket만 전달한다.
## 16. Feature 경계와 removable reference feature
Reference feature는 단순 UI fixture가 아니라 다음 경로를 모두 실행해야
@@ -1223,9 +1232,10 @@ contract와 실패 분기를 우선한다.
- [ ] runtime timeout/retry 설정이 실제 HTTP transport에 반영된다.
- [ ] QueryClient와 feature query bridge가 실제 route에서 동작한다.
- [ ] session UI API와 credential attachment가 분리되어 있다.
- [ ] logger와 telemetry가 HTTP/render/storage/cache failure 경로에
- [x] diagnostics와 telemetry가 HTTP/render/storage/cache failure 경로에
연결된다.
- [ ] page lifecycle에서 필요한 telemetry flush/cleanup이 수행된다.
- [x] `pagehide`에서 bounded telemetry queue를 flush하고 adapter `dispose`
lifecycle listener를 정리한다.
### 26.3 HTTP와 validation