Skip to content

perf(metrics): cut paid audio telemetry samples without dropping families - #25563

Merged
Git-on-my-level merged 1 commit into
mainfrom
lane/margin40-monitoring
Nov 17, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
lane/margin40-monitoring

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Failure-Class: none

Production listen/pusher send a full metric registry to GMP every 15s. Split that paid copy by consumer cadence: existing jobs keep privacy, custody/codec guards, freshness, WS gauges and GMP paging inputs at 15s; complementary -bulk jobs keep every other family at 60s. No application family, label, histogram bucket, image, deployment, local Prometheus job or HPA is removed/changed. This is a collection-cost optimization, not an emitter behavior fix.

Consumer audit: 509 observed exposition names, 148 source files across chart/deploy/docs/scripts/Grafana sources; per-metric locations and per-family sizing are checked in. Live ro-prod reads confirm both HPAs use local Prometheus (15s application jobs), not GMP. Live Grafana has 226 rules / 11 GMP rules; all relevant GMP application inputs remain 15s, no unknown live UID. Two unrelated rule queries drift from main and are disclosed in the runbook. Audio guard queries pin existing GMP job names, so the whole audio prefix stays there. Bulk metrics move to a -bulk job label; ad-hoc queries must include it. All Firestore caller/collection/kind/service_name/origin labels and all privacy metrics survive.

Measured 2026-11-17 04:08Z, with separate histogram-count reads at 04:12Z:

Workload Series before/after Keep 15s Move 60s Raw points/day before → after Estimated billed samples/day removed
listen 244,164 → 244,164 21,579 222,585 1,406.38M → 444.82M 703.59M
pusher 143,916 → 143,916 12,547 131,369 828.96M → 261.44M 404.33M
total 388,080 → 388,080 34,126 353,954 2,235.34M → 706.26M 1,107.92M

Scalar formula: current series × (5760 − 1440) points/day. Histograms use live per-family collection attribution allocated by logical series/workload; raw bucket arithmetic would overstate billing. No saving is credited for the uncensused remainder of raw scrape series; 0.36M/day of extra generated scrape-health points is subtracted from the dollar estimates. Current-count model: ~$59.8/day; hour-attribution model: ~$61.2/day. Rate: $0.054/M from the KB's two settled sample/cost pairs; official first 0–50B tier list price verified at $0.060/M. Exact discount and marginal account tier are unverified. This targets about $60/day but cannot guarantee that floor as replica counts/tier change. The extra full /metrics scrape raises scrape requests 25%; application CPU/latency acceptance belongs to Release. no saving is claimed until a settled billing day.

Rollout: release owner only; no merge, deploy, apply or production change by implementer. Use the runbook's fresh-snapshot renderer, then apply ONLY bulk.json followed by primary.json. It preserves live selectors, labels and auth rather than replaying unrelated chart drift (live pusher lacks the service_name fromPod mapping already in main). No pod roll. Do not use a full Helm upgrade for this change. Check both job cadences/up, label completeness, unchanged deployment pod templates, audio health, and a full new-state hour before billing attribution.

Rollback: apply the exact rollback.json snapshot, then delete only prod-omi-backend-listen-bulk and prod-omi-pusher-bulk. Revert this PR before the next Helm deployment (or use --set-string podMonitoring.bulkInterval= with companion cleanup). Restores the original full 15s scrape without restarting application pods. Emitter changes are deferred: eager fallback zeros support first-burst increase() and an emitter fix would require a separate image-roll PR/design.

Validation: focused chart/HPA/telemetry/secret contracts (119 tests); make preflight (46 checks); rendered candidate and rollback through the documented real preparation path, structural validation against the live v1 PodMonitoring CRD. Complementary filters tested over recorded metrics and future names; GMP paging inputs and protected prefixes checked at 15s; all non-PodMonitoring Helm objects identical when split is enabled/disabled. Kubernetes admission and runtime/billing effects are not claimed.

Runbook: backend/docs/runbooks/serving-metrics-cadence.md. Raw query/live readback evidence: workspace data/run-2026-11-17-margin-40/monitoring-implementation/ on m5-mbp.

View guided diff Turn on auto-fix

@Git-on-my-level
Git-on-my-level merged commit ba078a0 into main Nov 17, 2026
67 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/margin40-monitoring branch November 17, 2026 05:22
Git-on-my-level added a commit that referenced this pull request Nov 19, 2026
…5777)

Failure-Class: none

### Change

Production billed Prometheus samples fell from 2.277B ($122.93, Nov 16
UTC) to 1.324B ($71.48, Nov 18 UTC transition day) as #25563 rolled out.
The corresponding totals across production and development were $124.96
and $75.08. Leave the existing production PodMonitoring split in place
and move the two existing GMP bulk jobs from 60s to 120s. Local
Prometheus and primary GMP jobs remain at 15s. Backend Cloud Run
sidecars stay at their observed 60s cadence. This change does not touch
other collectors. The separate desktop-backend sidecar showed an
effective 30s cadence. Both Firestore attribution labels and every
metric family, label, job identity and histogram bucket are retained.
The prod Helm value `podMonitoring.bulkInterval` defaults to `120s` and
`60s` is the kill switch.

DESIGN: Not required. Only collector cadence changes. Source and live
query audit found no affected alert or dashboard input.

### Readback and estimate

Pusher split by the start of Nov 18 UTC and listen joined by 08:00 UTC.
The 24h window ending Nov 19 at 10:26 UTC is wholly after the split and
has 1.172B collected samples across GKE and Cloud Run. The Nov 19 10:18
UTC GKE census identified 44 high-volume scalar families exclusive to
the two bulk jobs (215,987 live series). They accounted for 330.65M
attributed samples in that 24h window. Halving their cadence projects
165.33M fewer samples/day and $8.93/day at the observed $0.054/M. The
model projects 1.007B samples/day and $54.36/day overall, $68.57 below
Nov 16 in production. Attribution is a billing proxy and the estimate
depends on target counts, workload and the rate. The current scalar
series count alone projects $8.40/day of additional savings. Use
complete settled UTC billing days to verify the $60/day target.

Use `sum by
(metric_type)(increase(monitoring_googleapis_com:collection_attribution_write_sample_count{attribution_dimension="cluster",attribution_id="prod-omi-gke",metric_type=~"prometheus.googleapis.com/(omi_(fallback_total|stt_cost_routing_(ignored_deaths|settlements)_total|firestore_billed_reads(_by_caller|_by_origin)?_total)/counter|omi_episode_compose_seconds/histogram)"}[24h]))`,
evaluated at the following UTC midnight. Repeat with
`attribution_id="__run__"` as the Cloud Run comparison. The billing
export has the total SKU rather than the per-family breakout. Use
project.id='based-hardware' to match the PromQL scope. Use the billing
SQL and rollout/rollback steps in the
[runbook](backend/docs/runbooks/serving-metrics-cadence.md#120s-bulk-follow-up).

### Verification

Audit used ro-prod for GCP and a read-only Grafana credential. Checked
source alerts and dashboards, 37 live Cloud Monitoring policies, one
Cloud Monitoring dashboard, 269 Grafana rules and 50 Grafana dashboards.
Local fallback/STT alerts and resilience dashboards use the in-cluster
datasource. The GMP Firestore paging rules use
caller/overflow/completed-audio inputs on the existing 15s jobs. No live
managed Rules, ClusterRules or GlobalRules were present. Ad-hoc bulk
queries should use a window of at least 8m for rate/increase. Release
can patch just the two existing bulk PodMonitoring intervals and restore
the prior 60s values on rollback. This needs no pod roll.


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/25777?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="View guided diff"
src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>
<a
href="https://www.cubic.dev/action/auto-fix/pr/BasedHardware/omi/25777?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F25777&source=description"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img
alt="Turn on auto-fix"
src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant