-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add sourceTag
to PineconeConfiguration
and additionalHeaders
to data plane calls
#197
Conversation
This looks directionally in line with what's needed for PRD Integration Attributes - SDK Attribution. Related PR from Python client: pinecone-io/pinecone-python-client#324 |
…data plane operations and Index constructor, add and update unit tests
…malization logic and unit tests
b723896
to
79cc4ea
Compare
integrationId
to PineconeConfiguration
and additionalHeaders
to data plane callssourceTag
to PineconeConfiguration
and additionalHeaders
to data plane calls
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Is there a corresponding docs (or README) update explaining the new config?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM overall
Problem
We want to provide the ability for consumers to include a
source_tag
to identify the source of requests while using the client. Additionally, there are debugging and development scenarios where being able to pass additional headers with network requests would be convenient.Solution
sourceTag
toPineconeConfiguration
. UpdatebuildUserAgent()
to take inPineconeConfiguration
, which should be available at all the points we call to build the agent. IfsourceTag
is provided it will be normalized, and inserted into theUser-Agent
header for all network requests with this format:source_tag=<normalizeSourceTag>
.[a-z0-9_ ]
_
additionalHeaders
to theIndex
constructor. Custom headers can now be provided when targeting a specific index.Index
now passes these headers toVectorOperationsProvider
when setting up the API.VectorOperationsProvider
to applyadditionalHeaders
to the APIConfiguration
when provided.Type of Change
New feature, but specific to developer / support usage.
Test Plan
New unit test files:
indexOperationsBuilder.test.ts
user-agent.test.ts
New unit test for validating
additionalHeaders
is passed as expected, a bit of refactoring inindex.test.ts
which appears messier than it is.Running locally with
PINECONE_DEBUG=true
to make sure the custom headers /sourceTag
are passed on requests when provided.Passing
integrationId
Passing
additionalHeaders
toIndex