Skip to content

v6.2.0 Release

Choose a tag to compare

@austin-denoble austin-denoble released this 01 Apr 00:44
6072a1d

Extended observability fields in ResponseMetadata

The ResponseMetadata listener now surfaces three new nullable fields giving you visibility into per-request consumption and operation outcomes:

  • getReadUnits() — read units consumed (available on query, fetch, and list operations)
  • getUpsertedCount() — number of vectors upserted (available on upsert operations)
  • getMatchedRecords() — number of records matched (available on update operations)

These fields return null when not applicable to the operation type.

import io.pinecone.clients.Pinecone;
import io.pinecone.clients.Index;
import java.util.Arrays;

Pinecone pinecone = new Pinecone.Builder(System.getenv("PINECONE_API_KEY"))
    .withResponseMetadataListener(metadata -> {
        System.out.printf("Operation: %s | Client: %dms | Server: %dms | Network: %dms%n",
            metadata.getOperationName(),
            metadata.getClientDurationMs(),
            metadata.getServerDurationMs(),
            metadata.getNetworkOverheadMs());

        if (metadata.getReadUnits() != null) {
            System.out.printf("Read units consumed: %d%n", metadata.getReadUnits());
        }
        if (metadata.getUpsertedCount() != null) {
            System.out.printf("Upserted count: %d%n", metadata.getUpsertedCount());
        }
        if (metadata.getMatchedRecords() != null) {
            System.out.printf("Matched records: %d%n", metadata.getMatchedRecords());
        }
    })
    .build();

Index index = pinecone.getIndexConnection("example-index");

index.query(5, Arrays.asList(1.0f, 2.0f, 3.0f));
// Output: Operation: query | Client: 45ms | Server: 32ms | Network: 13ms
//         Read units consumed: 5

index.upsert("v1", Arrays.asList(1.0f, 2.0f, 3.0f));
// Output: Operation: upsert | Client: 52ms | Server: 38ms | Network: 14ms
//         Upserted count: 1
` ``

## What's Changed
* chore: add Cursor IDE configuration and development tools by @jhamon in https://github.com/pinecone-io/pinecone-java-client/pull/211
* Automated test resource cleanup by @jhamon in https://github.com/pinecone-io/pinecone-java-client/pull/212
* fix: client build failure in test cleanup utility by @jhamon in https://github.com/pinecone-io/pinecone-java-client/pull/214
* feat: Add readUnits, upsertedCount, and matchedRecords to ResponseMetadata by @rasharab in https://github.com/pinecone-io/pinecone-java-client/pull/218
* Bump version to `6.2.0`, resolve integration test flakiness by @austin-denoble in https://github.com/pinecone-io/pinecone-java-client/pull/219


**Full Changelog**: https://github.com/pinecone-io/pinecone-java-client/compare/v6.1.0...v6.2.0