Skip to content

Commit

Permalink
fix: make runtimeVersion private final
Browse files Browse the repository at this point in the history
  • Loading branch information
rishtigupta committed Jun 28, 2024
1 parent 04110f4 commit 2383d0f
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ final class UserHeaderInterceptor implements ClientInterceptor {
Metadata.Key.of("runtime-version", ASCII_STRING_MARSHALLER);
private final String tokenValue;
private final String sdkVersion;
String runtimeVer = System.getProperty("java.vendor") + ", " + System.getProperty("java.version");
private final String runtimeVersion;
private boolean isUserAgentSent = false;

UserHeaderInterceptor(String token, String clientType) {
tokenValue = token;
sdkVersion =
String.format(
"java:%s:%s", clientType, this.getClass().getPackage().getImplementationVersion());
runtimeVersion = System.getProperty("java.vendor") + ", " + System.getProperty("java.version");
}

@Override
Expand All @@ -40,7 +41,7 @@ public void start(Listener<RespT> listener, Metadata metadata) {
metadata.put(AUTH_HEADER_KEY, tokenValue);
if (!isUserAgentSent) {
metadata.put(SDK_AGENT_KEY, sdkVersion);
metadata.put(RUNTIME_VERSION_KEY, runtimeVer);
metadata.put(RUNTIME_VERSION_KEY, runtimeVersion);
isUserAgentSent = true;
}
super.start(listener, metadata);
Expand Down

0 comments on commit 2383d0f

Please sign in to comment.