Skip to content

feat: meter Pinecone query read units by family and caller - #24383

Merged
Git-on-my-level merged 3 commits into
mainfrom
lane/pcmeter
Nov 2, 2026
Merged

Git-on-my-level merged 3 commits into
mainfrom
lane/pcmeter

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Record Pinecone provider query attempts and returned read units by the shared namespace family, actual route mode (legacy or partitioned), and a closed set of explicit callers. Unknown labels map to other; no UID or partition namespace is exported. Missing usage contributes no inferred units and has a separate counter. Metering errors are swallowed and counted.

All 11 query sites in backend/database/vector_db.py pass their function name to OwnerIndex.query. Serving account-purge freshness verification is the one direct _query bypass and is separately metered as account_purge_verify, preserving headers, retries and routing. Operator migration queries, fetch/list and mutations are outside this query meter. No route/copy/mutation behavior changes; ships on without a flag.

Live response-shape proof: pinned pinecone==7.3.0, memories-backend-dev, synthetic-owner-only query, no matches or writes, metadata/values disabled. Response type QueryResponse, usage type pinecone.core.openapi.db_data.model.usage.Usage, usage.read_units == 1 (integer). The meter handles SDK attributes and mapping shapes. No production account data read.

Integrated local validation on 648ab1813aa5afd12652f2b3083654394ee1d87a: 424 tests passed via nice -n 19 bash backend/test.sh, selected with BACKEND_UNIT_TEST_FILE_LIST and run through omi-heavy (26 metering, 53 owner-routing, 345 storefront tests). Coverage includes real SDK models, integer/zero/missing/invalid units, fraction/float/boolean rejection, bounded labels, failed provider calls, exporter failures, preserved arguments/results, both account-purge copies, sync/async caller wiring and sync scrape admission. The independent storefront baseline fix is included from main (#24389); the PR diff remains seven meter files.

make preflight and scripts/pr-preflight --metadata-only --pr-body-file <draft> passed with the committed candidate and tracked files unchanged throughout. A local no-network smoke drove the actual OwnerIndex.query and utils.metrics.metrics_response with a pinned SDK response: the default-registry exporter contained one query and one read unit, and no owner label. Usage validation follows the pinned client's integer-only data-plane schema. GCP read tier: ro-prod; only infrastructure metric aggregates were read. Luna review and GitHub CI are separate merge gates.

Read-only ro-prod GMP aggregates on 2026-11-02 confirm existing Cloud Run application scraping for backend, desktop-backend, sync, sync-backfill, integration and notifications. The sync sidecar allowlist now admits omi_pinecone_.*. GKE listen/pusher use authenticated local Prometheus /metrics jobs but were absent from GMP; the GPU batch worker uses a separate registry and performs no Pinecone queries. The local Prometheus sync bridge does not import these counters. Details and acceptance commands: backend/docs/runbooks/pinecone-query-metering.md.

Dashboard-free query: which caller spends the most reported read units over 24h, for the GMP Cloud Run scope:

topk(10, sum by (caller) (
  increase(omi_pinecone_read_units_total{project_id="based-hardware",cluster="__run__"}[24h])
))

Inspect omi_pinecone_query_missing_usage_total and omi_pinecone_query_metering_errors_total alongside it. GMP totals do not include listen/pusher until that collection gap is resolved or local series are analyzed separately. This meter does not establish a root cause or savings.

Deployment: rollout lead to include backend image plus revision-local sync scrape profile in the next backend train; listen/pusher need their own image rolls to emit this instrumentation. Verify running release identity and newly emitted samples after deploy. No deployment performed by this lane.

Product invariants affected

none

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-11-02T12:05:44.613357Z
We couldn’t complete this review. Comment @codex review to try again.
d615466 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 7 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Copy link
Copy Markdown
Member Author

Required native Luna review is complete at head 648ab1813aa5afd12652f2b3083654394ee1d87a.

Round 1 requested integer-only read units, matching the pinned 7.3.0 SDK. Commit 79ccea5e908a rejects floats/booleans/negative usage and preserves nonnegative integers, including zero. It also fixes the inline async-caller audit finding.

Round 2 was a read-only delta review routed by agentctl pool review to Luna, collected through canonical review.sh. Verdict: SHIP, no findings in the fix delta. The reviewer confirmed the seven-file PR scope and preserved correction; it did not rerun tests. pcmeter independently ran the stable integrated 424-test harness, preflight, PR metadata validation and actual application exporter smoke described above.

Exact-head CI remains in progress; source review does not establish deployed metric ingestion. Rollout lead owns merge and the next backend train. Local collected review artifact: /Volumes/Ephemeral/scratch/two-lane-lead/review-24383-r2.md.

@Git-on-my-level
Git-on-my-level merged commit d2ed1c8 into main Nov 2, 2026
64 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/pcmeter branch November 2, 2026 16:15
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