Skip to content

feat: Add readUnits, upsertedCount, and matchedRecords to ResponseMetadata#218

Open
rasharab wants to merge 3 commits intopinecone-io:mainfrom
rasharab:update-responsemetadata-read-units
Open

feat: Add readUnits, upsertedCount, and matchedRecords to ResponseMetadata#218
rasharab wants to merge 3 commits intopinecone-io:mainfrom
rasharab:update-responsemetadata-read-units

Conversation

@rasharab
Copy link
Copy Markdown
Contributor

@rasharab rasharab commented Mar 27, 2026

BACKGROUND:
Our company is using your listener pattern for Otel metrics, but there's just not enough valuable information for us.
We're adding fields we consider necessary for our operations.

Adds usage and operation-result fields to ResponseMetadata so users can track read units, upserted count, and matched records via the metadata listener.

Changes:

  • ResponseMetadata: Added three new nullable Integer fields (readUnits, upsertedCount, matchedRecords) with getters, builder methods, and conditional toString()
  • ResponseMetadataInterceptor: Added onMessage() override to capture gRPC response bodies and extract fields via reflection. Added List to TRACKED_OPERATIONS.
  • ResponseMetadataTest: 10 new tests (22 total, all passing)
  • README.md: Updated observability example and method table with new getters

Note

Medium Risk
Medium risk because it changes the gRPC interceptor to reflectively parse response bodies during onMessage(), which could affect performance or subtly vary by response type; failures are handled by returning nulls with debug logging.

Overview
Adds richer per-request observability metadata by extending ResponseMetadata with three new nullable fields: readUnits, upsertedCount, and matchedRecords, including builder setters, getters, and toString() output only when present.

Enhances metadata capture in the gRPC client interceptor by tracking List operations and extracting the new fields from response messages via reflection during onMessage(), then emitting them through the existing response-metadata listener.

Updates README documentation/examples and expands unit test coverage to validate defaults, builder wiring, and toString() behavior for the new fields.

Written by Cursor Bugbot for commit a164dee. This will update automatically on new commits. Configure here.

Agent-Id: agent-99b8efc1-3adb-4099-8683-03d0a3351bed
Linked-Note-Id: b55dbb0b-4a64-437e-93bd-f29d287c9b0c
Agent-Id: agent-e63157ed-432d-4883-9f3e-1895a0b24e7a
Agent-Id: agent-3f21d110-2d0f-42e3-aae2-b6331803d85a
// Operations to track (matches VectorService RPC method names)
private static final Set<String> TRACKED_OPERATIONS = new HashSet<>(Arrays.asList(
"Upsert", "Query", "Fetch", "Update", "Delete"
"Upsert", "Query", "Fetch", "Update", "Delete", "List"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We use a LOT of list operations. This is necessary for us.

@rasharab
Copy link
Copy Markdown
Contributor Author

FYI @jhamon

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