Skip to content

Commit

Permalink
Fix SDK version extraction (#55)
Browse files Browse the repository at this point in the history
## Problem

While trying to add SDK version to user agent string, it fails.

## Solution

Hard coded the value into the user agent string.

## Type of Change

- [X] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] This change requires a documentation update
- [ ] Infrastructure change (CI configs, etc)
- [ ] Non-code change (docs, etc)
- [ ] None of the above: (explain here)

## Test Plan

Ran integration tests locally.
  • Loading branch information
rohanshah18 authored Jan 2, 2024
1 parent 231657c commit 3a0de7b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

[comment]: <> (When bumping [pc:VERSION_LATEST_RELEASE] create a new entry below)
### Unreleased version
### v0.7.2
- Fix extraction of SDK version

### v0.7.0
- Add support to list indexes
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ Maven:
<dependency>
<groupId>io.pinecone</groupId>
<artifactId>pinecone-client</artifactId>
<version>0.7.1</version>
<version>0.7.2</version>
</dependency>
```

[comment]: <> (^ [pc:VERSION_LATEST_RELEASE])

Gradle:
```
implementation "io.pinecone:pinecone-client:0.7.1"
implementation "io.pinecone:pinecone-client:0.7.2"
```

[comment]: <> (^ [pc:VERSION_LATEST_RELEASE])

Alternatively, you can use our standalone uberjar [pinecone-client-0.7.1-all.jar](https://repo1.maven.org/maven2/io/pinecone/pinecone-client/0.7.1/pinecone-client-0.7.1-all.jar), which bundles the pinecone client and all dependencies together inside a single jar. You can include this on your classpath like any 3rd party JAR without having to obtain the *pinecone-client* dependencies separately.
Alternatively, you can use our standalone uberjar [pinecone-client-0.7.2-all.jar](https://repo1.maven.org/maven2/io/pinecone/pinecone-client/0.7.2/pinecone-client-0.7.2-all.jar), which bundles the pinecone client and all dependencies together inside a single jar. You can include this on your classpath like any 3rd party JAR without having to obtain the *pinecone-client* dependencies separately.

[comment]: <> (^ [pc:VERSION_LATEST_RELEASE])

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pineconeClientVersion = 0.7.1
pineconeClientVersion = 0.7.2
16 changes: 3 additions & 13 deletions src/main/java/io/pinecone/PineconeClientConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,18 +139,8 @@ private String maskedApiKey() {
}

public String getUserAgent() {
Properties properties = new Properties();
String userAgentLanguage = "lang=java";
String version = (this.getUsageContext() != null) ?
userAgentLanguage + "; usageContext=" + this.getUsageContext()
: userAgentLanguage;

try (FileInputStream input = new FileInputStream("gradle.properties")) {
properties.load(input);
version = properties.getProperty("pineconeClientVersion") + "; " + version;
} catch (IOException e) {
throw new PineconeException("Unable to extract pinecone client version");
}
return version;
String userAgentLanguage = "lang=java; pineconeClientVersion = v0.7.2";
return (this.getUsageContext() != null) ?
userAgentLanguage + "; usageContext=" + this.getUsageContext() : userAgentLanguage;
}
}

0 comments on commit 3a0de7b

Please sign in to comment.