Commit Graph

3 Commits

Author SHA1 Message Date
windpacer
b820e6c33a feat(report): P1c 온라인 KPI 누적기 (live_kpi) + 메트릭 소스 일반화
온라인 히스토리안 3계층 — 실시간 KPI를 history_1s에서 산출·캐싱.

- 메트릭 소스 일반화: history_table | history_1s | history_1min_src | fast_record.
  history_1min_src = 연속집계 드롭인 호환뷰(bucket→recorded_at).
- Hc900LiveKpiService: 매 15s 오늘(KST) 컬럼별 KPI(production/yield/energy/closure)를
  history_1s에서 재계산해 live_kpi upsert. 재계산=러닝상태의 stateless 동등판(causal 동치,
  크래시 복구 불필요). 컬럼 state(normal/idle/error) 산출.
- live_kpi 테이블 + GET /api/report/live 조회 엔드포인트.
- Report:LiveKpi config(Enabled/IntervalSeconds/Source).

검증: 라이브 live_kpi 28행(7컬럼×4KPI) 15s 갱신, /live 정상. 데모 sim은 totalizer가
평평해 값 0/idle(플러밍 정상, 실데이터면 실값).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 07:52:31 +09:00
windpacer
3506a67c28 feat(report): P1b 연속집계 history_1min — 1초 버퍼 60초 롤업(장기 무손실)
온라인 히스토리안 2계층: history_1s(최근 14일, 고해상) + history_1min(장기, 60초).

- history_1min 연속집계(timescaledb.continuous): time_bucket('1 min') + last(value)/last(controller_id).
  refresh 정책(start 3h, end 10min, 5분마다) → 집계 lag ≪ 보존윈도(14일)이라 1초 raw evict 전 materialize.
- Hc900FastHistoryService.EnsureSchemaAsync에 cagg 생성+정책 멱등 추가. SQL 파일 동기화.

검증: 2계층 값 일치(1s last == 1min cagg), 정책 활성, 무손실 불변식 충족.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 07:13:12 +09:00
windpacer
7f67f0e54d feat(report): P1a 1초 링버퍼 히스토리안 (history_1s)
온라인 히스토리안 1계층 — 디스크 상한 고정 1초 버퍼.

- history_1s Timescale 하이퍼테이블(1h 청크) + 압축(6h) + 보존 14일(청크DROP, 디스크 상한 고정).
- Hc900FastHistoryService: 매 1초 realtime_table 큐레이션 태그 → history_1s append.
  기동 시 스키마/정책 멱등 생성. Hc900HistoryService(60s) 패턴.
- ReportColumnMap.HistorianTags(): 메트릭/마스크가 읽는 태그를 기존 config에서 유도(~105개,
  중복정의 없음) — 유량 .PV/.QV, 진공, 민감단 TC, 하부루프 .PV/.SP/.OP.
- Report:Historian config(Enabled/IntervalSeconds/RetentionDays).

검증: 라이브 초당 ~38행 append, 샘플 간격 ~1.004s, 보존/압축 정책 활성.
주의(데모): realtime 폴링이 areas 61/62/81만 커버 → 1s 버퍼도 해당 컬럼만(배포 시 전 컨트롤러).
1s 버퍼 주 가치는 .PV/.OP 동특성; .QV 적산은 60s로도 정확.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 04:56:15 +09:00