-
Notifications
You must be signed in to change notification settings - Fork 54
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
fix: protobuf version not always getting set in headers #3322
Conversation
gax-java/gax/src/main/java/com/google/api/gax/util/ClassLoaderWrapper.java
Outdated
Show resolved
Hide resolved
gax-java/gax/src/main/java/com/google/api/gax/core/GaxProperties.java
Outdated
Show resolved
Hide resolved
gax-java/gax/src/main/java/com/google/api/gax/core/GaxProperties.java
Outdated
Show resolved
Hide resolved
gax-java/gax/src/main/java/com/google/api/gax/core/GaxProperties.java
Outdated
Show resolved
Hide resolved
gax-java/gax/src/main/java/com/google/api/gax/util/IClassLoaderWrapper.java
Outdated
Show resolved
Hide resolved
gax-java/gax/src/test/java/com/google/api/gax/core/GaxPropertiesTest.java
Outdated
Show resolved
Hide resolved
LGTM. Blake for approval. |
// If manifest file is not available default to protobuf generic version 3 as we know | ||
// RuntimeVersion class is | ||
// available in protobuf jar 4+. | ||
return getBundleVersion(clazz).orElse("3"); |
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.
So we are going to have two different format of protobuf versions (3.x.x vs 3)? Is it going to cause issues when we try to aggregate the metrics?
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.
There might be 3.1.2, which provides precision. But there shouldn't be any 3.x.x.
We shouldn't be providing precision (significant digits) when we don't know them. We can fix any parsing logic as necessary.
package com.google.api.gax.util; | ||
|
||
/* Wrapper class for reflection {@link java.lang.Class} methods to enable unit testing. */ | ||
public class ClassWrapper { |
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.
I don't think it's worth it to introduce a new public class just for unit testing in Gax. Can we move the wrapper methods to GaxProperties
and make them package private?
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.
i hope I understood what you meant. I moved the class to package private so I could continue to mock, or did you meant do not unit test this code?
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.
I refactored to remove the wrapper class/methods at all. Let me know what you think!
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.
Thanks, it looks good to me on the surface!
did you meant do not unit test this code
We should definitely do unit tests if possible. I see that the sonar coverage is complaining about the coverage now, can you please take a look at it and see if it makes sense?
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.
thanks for calling out, I missed a test case! Fixed
Quality Gate passed for 'gapic-generator-java-root'Issues Measures |
Quality Gate failed for 'java_showcase_integration_tests'Failed conditions |
In order to maximize amount of times protobuf version is logged we have updated logic as follows:
Also updated showcase test to fail in the case protobuf version is missing
Tested: