-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add logging infra to PineconeClient and Index. (#126)
Fixes #118 * Add logging infra to PineconeClient and Index. The idea is, each operation has a pair of log entries - start is logged at Trace level (and should be ignored in most cases), and then we either log success at Debug level, or error at Error level. Only logging basic information like operation type and the index name - we want to avoid printing sensitive data in the logs for security reasons. Also wired up logger(factory) to GrpcChannel and HttpClient for more detailed logging. * Iterate on logging impl and more - Remove excessive logging for now (tentative) - Skip .Trace log level in tests which outputs sensitive http headers - Introduce exception types to preserve and expose partial success state on parallel batch operation failure - Remove dependency on CommunityToolkit.Diagnostics * Further work: - Redact API key from logged headers - Match request headers behavior of the official clients - Add support for client-side gRPC load balancing (it does not help much because Pinecone uses a misconfigured reverse-proxy that has barely any streams over a single H2 connection) - Add batching and parallelization to Delete(vectors) - Update dependencies --------- Co-authored-by: neon-sunset <[email protected]>
- Loading branch information
1 parent
3eab568
commit d462352
Showing
18 changed files
with
586 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
using Microsoft.Extensions.Http; | ||
|
||
namespace Pinecone; | ||
|
||
internal static class Constants | ||
{ | ||
public const string RestApiKey = "Api-Key"; | ||
public const string GrpcApiKey = "api-key"; | ||
|
||
public static readonly string Version = | ||
typeof(Constants).Assembly.GetName().Version?.ToString(3) ?? "0.0.0"; | ||
|
||
public static readonly HttpClientFactoryOptions RedactApiKeyOptions = new() | ||
{ | ||
ShouldRedactHeaderValue = h => h.Equals(RestApiKey, StringComparison.OrdinalIgnoreCase) | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.