feat(phase 3.2): OBS metrics scraper — PowerShell + Scheduled Task, JSONL hourly logs #27

Merged
deco merged 1 commit from feat/phase-3.2-obs-metrics-scraper into main 2026-05-21 22:46:16 +03:00
Owner

Summary

Phase 3.2 of the Stream-a-Thon plan. Long-running PowerShell sampler that records obs64.exe working set, handles, threads, page faults, CPU total, plus the host's free/total physical memory, every 10 seconds. Output is one JSON line per sample appended to obs-metrics-YYYY-MM-DD-HH.log under -LogDir.

Closes the Phase 3.2 acceptance: "obs-metrics.log rolled hourly." Rotation is filename-based — each hour's samples sit in their own file, no separate rotation step needed.

Design

  • scrape-obs-metrics.ps1 stays running across hours; switches to the next hour's filename at the top of every hour automatically.
  • Old files past -RetainHours (default 168 = 7 days) get cleaned up in the same loop (~24 MiB total disk footprint at defaults).
  • process.present=false rows keep the same shape with null fields so downstream JSONL parsers don't have to special-case missing keys.
  • install-scheduled-task.ps1 registers the sampler as a Windows Scheduled Task with at-boot trigger + RestartCount 999 so it comes back after crashes / reboots.
  • A Node-side format test parses a fixture of representative rows so the producer (PS) and any future consumer share a pinned contract.

Files

  • scripts/obs-metrics-scraper/scrape-obs-metrics.ps1 — the sampler
  • scripts/obs-metrics-scraper/install-scheduled-task.ps1 — task registrar
  • scripts/obs-metrics-scraper/README.md — install / usage / format
  • scripts/obs-metrics-scraper/__tests__/format.test.ts — +5 format tests
  • scripts/obs-metrics-scraper/__tests__/sample-output.fixture.jsonl — representative rows

Test plan

  • 5/5 format tests pass
  • tsc --noEmit clean
  • npm run audit:sqlite-opens clean
  • Install on Windows OBS host: pwsh -File install-scheduled-task.ps1; tail latest hourly file; verify obs64.exe metrics appear with process.present=true
  • Cross-day check: leave it running for ≥ 25 hours; verify hourly file rolls + a stale file gets cleaned (set -RetainHours low temporarily)
## Summary Phase 3.2 of the Stream-a-Thon plan. Long-running PowerShell sampler that records `obs64.exe` working set, handles, threads, page faults, CPU total, plus the host's free/total physical memory, every 10 seconds. Output is one JSON line per sample appended to `obs-metrics-YYYY-MM-DD-HH.log` under `-LogDir`. Closes the Phase 3.2 acceptance: \"`obs-metrics.log` rolled hourly.\" Rotation is filename-based — each hour's samples sit in their own file, no separate rotation step needed. ## Design - `scrape-obs-metrics.ps1` stays running across hours; switches to the next hour's filename at the top of every hour automatically. - Old files past `-RetainHours` (default 168 = 7 days) get cleaned up in the same loop (~24 MiB total disk footprint at defaults). - `process.present=false` rows keep the same shape with null fields so downstream JSONL parsers don't have to special-case missing keys. - `install-scheduled-task.ps1` registers the sampler as a Windows Scheduled Task with at-boot trigger + RestartCount 999 so it comes back after crashes / reboots. - A Node-side format test parses a fixture of representative rows so the producer (PS) and any future consumer share a pinned contract. ## Files - `scripts/obs-metrics-scraper/scrape-obs-metrics.ps1` — the sampler - `scripts/obs-metrics-scraper/install-scheduled-task.ps1` — task registrar - `scripts/obs-metrics-scraper/README.md` — install / usage / format - `scripts/obs-metrics-scraper/__tests__/format.test.ts` — +5 format tests - `scripts/obs-metrics-scraper/__tests__/sample-output.fixture.jsonl` — representative rows ## Test plan - [x] 5/5 format tests pass - [x] `tsc --noEmit` clean - [x] `npm run audit:sqlite-opens` clean - [ ] Install on Windows OBS host: `pwsh -File install-scheduled-task.ps1`; tail latest hourly file; verify obs64.exe metrics appear with `process.present=true` - [ ] Cross-day check: leave it running for ≥ 25 hours; verify hourly file rolls + a stale file gets cleaned (set `-RetainHours` low temporarily)
feat(phase 3.2): OBS metrics scraper — PowerShell + Scheduled Task, JSONL hourly logs
All checks were successful
Lint and Build / build (pull_request) Successful in 4m24s
b8ab83a6f7
Long-running PowerShell sampler that records obs64.exe working set,
handle count, thread count, page faults, and CPU total, plus the
host's free/total physical memory, every 10 seconds. Output is one
JSON line per sample appended to obs-metrics-YYYY-MM-DD-HH.log under
-LogDir — filename-based rotation, no separate roller needed.
Closes the Phase 3.2 acceptance bar: obs-metrics.log rolled hourly.

scrape-obs-metrics.ps1 stays running across hours and switches to a
new file at the top of each hour automatically; old files past
-RetainHours (default 168 = 7 days) get deleted in the same loop.
process.present=false rows keep the same row shape with null fields
so downstream JSONL parsers don't have to special-case missing keys.

install-scheduled-task.ps1 registers the sampler as a Windows
Scheduled Task with at-boot trigger and RestartCount 999 so the
sampler comes back up after process crashes or host reboots.

A Node-side format test parses a fixture of representative rows so
the producer (PowerShell) and consumer (any future log analyzer)
share a pinned contract.

- scripts/obs-metrics-scraper/scrape-obs-metrics.ps1
- scripts/obs-metrics-scraper/install-scheduled-task.ps1
- scripts/obs-metrics-scraper/README.md
- scripts/obs-metrics-scraper/__tests__/format.test.ts (+5 tests)
- scripts/obs-metrics-scraper/__tests__/sample-output.fixture.jsonl

This deliverable is Windows-only at runtime; the format test runs on
any platform. type-check, lint, audit:sqlite-opens all clean.
deco merged commit 6d40e2643e into main 2026-05-21 22:46:16 +03:00
deco deleted branch feat/phase-3.2-obs-metrics-scraper 2026-05-21 22:46:16 +03:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
deco/cuesheet!27
No description provided.