feat(pi-durable): scrape the usage sampler and alert on OpenCode Go's allowance (durable-pi-workspace#399) #20
No reviewers
Labels
No labels
ready-for-agent
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bryan/nix-configs!20
Loading…
Reference in a new issue
No description provided.
Delete branch "p399-3-go-alerts"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
P399.3 of durable-pi-workspace#399's plan (
vault/2026-11-10-opencode-go-usage-from-pi-sessions-plan.mdthere, mechanism 6).Changed (
modules/services/pi-durable.nix, in the sampler's block, with the monitoring module only):pi-durable-samplerfor127.0.0.1:<sampler.port>/metrics.e108f3b):OpenCodeGoAllowanceHigh(warning): any window'spi_durable_sampler_opencode_go_share >= 0.8for 5m;OpenCodeGoAllowanceCritical(critical):>= 0.95for 5m;OpenCodeGoUsageUnreadable(warning): no source readable, a configured directory missing, or a file unreadable, for 30m, each term alone (bad lines left out: Pi skips them too);OpenCodeGoUnknownModel(warning): a model counted at the dearest weight for 1h.Each says the OpenCode console is authoritative and what 100% means. They replace Hermes's "Watch OpenCode Go allowance" job and drop its 50% notice.
modules/services/AGENTS.md: the sampler's line.Tests: new
scripts/test_opencode_go_alerts.py(14): the scrape and that it followssampler.port; nothing without the sampler;promtool check metricson the sampler's Go text;promtool test rulesfor each rule firing and quiet, 94% not critical, a window dropping back, bad lines alone quiet, the unreadable rule on its own series alone, each rule's severity pinned. Mutations of each threshold, the missing-dirs term, the unknown model'sfor, the port, a severity and the sum-for-oreach fail a test.test_pi_durable_module.py,test_monitoring_content_probes.py,test_pi_bots_service.pyandtest_dashy_status_api.pypass;darwin-rebuild build --flake .#studiobuilds.Review: a visible Pi reviewer (Opus 5.5, medium, work seat) reviewed
392e74a..f2279a1and approved, with one should-fix (the tests took the expected severity from the rule under test) and one nit (the unreadable rule's sum needed all three series, so the old reader's lonereadable 0raised nothing). It checkedpromtool check configon Studio's generatedprometheus.ymland that/metricsanswers loopback without a login. Both fixed in2ea1670.After
update-system: Prometheus's targets listpi-durable-samplerup; the four rules load with health ok. The share series appear once the sampler runs the new reader (P399.2's commissioning). Then Hermes's watcher is paused.feat(pi-durable): scrape the usage sampler and alert on OpenCode Go's allowance (durable-pi-workspace#399)to WIP: feat(pi-durable): scrape the usage sampler and alert on OpenCode Go's allowance (durable-pi-workspace#399)WIP: feat(pi-durable): scrape the usage sampler and alert on OpenCode Go's allowance (durable-pi-workspace#399)to feat(pi-durable): scrape the usage sampler and alert on OpenCode Go's allowance (durable-pi-workspace#399)