-
Notifications
You must be signed in to change notification settings - Fork 53
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
docs: Update RetrySettings javadocs to include polling #1863
Conversation
[gapic-generator-java-root] Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
[java_showcase_integration_tests] Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
[java_showcase_unit_tests] Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
* Duration.ZERO}. | ||
* | ||
* <p>If there are no configurations, Retries have the default initial retry delay value set above | ||
* and LROs have a default initial poll delay value of {@code Duration.ofMillis(5000)} (5 |
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.
Where is the default number coming from? Can we link to where the default number is actually specified? Same comment for all the default numbers below.
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 have a reference here:
sdk-platform-java/gax-java/gax/src/main/java/com/google/api/gax/retrying/RetrySettings.java
Lines 70 to 72 in 1497346
* <p>In Cloud Client Libraries, Retry and LRO Retry Settings may be configured for each service and | |
* RPC. These values are set by the service teams and may be found by looking at the | |
* {Service}StubSettings.java file in each library. |
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.
What are the default numbers if there is no gRPC config file? I guess the numbers are coming from constants in GAX ? The concern I have is if we change the default numbers in the future, we would have to change the numbers here as well, and it's very easy to forget to change here.
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.
If there is nothing configured inside the grpc config file, the generator will create a RetrySettings with the default values with values listed above (For example: https://github.com/googleapis/google-cloud-java/blob/8452ac3a8eefa8a9e49ff83187b33be26efe6a01/java-batch/google-cloud-batch/src/main/java/com/google/cloud/batch/v1/stub/BatchServiceStubSettings.java#L518). This is what I'll call the RetrySettings default values.
Service teams can modify the grpc config file and that will provide default values for certain callables. These default values is what I'll call the callable default values. This is the RetrySettings which will be configured like: https://github.com/googleapis/google-cloud-java/blob/8452ac3a8eefa8a9e49ff83187b33be26efe6a01/java-batch/google-cloud-batch/src/main/java/com/google/cloud/batch/v1/stub/BatchServiceStubSettings.java#L507-L516
I believe they're both technically default values. The Javadoc I updated only refers the RetrySettings default values since the callable default values differ per service. I can add this explanation in so it's clearer to the readers.
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.
The default numbers in RetrySettingsComposer is what I was referring to. If those numbers change, we would have to update the numbers here as well. But since those numbers are in the generator, I don't think it's a good idea to expose the implementation details to Gax either, I think we can leave them as they are for now.
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.
The default numbers in RetrySettingsComposer is what I was referring to. If those numbers change, we would have to update the numbers here as well. But since those numbers are in the generator, I don't think it's a good idea to expose the implementation details to Gax either, I think we can leave them as they are for now.
Yeah, those values are set in the generator (and the generator only sets defaults for LROs). I think if we make an effort to change those, we'll have to remember to update our docs here manually. I'd like for an automated way to do that, but linking to the generator code doesn't seem ideal.
I'll keep as is for now then.
gax-java/gax/src/main/java/com/google/api/gax/retrying/RetrySettings.java
Outdated
Show resolved
Hide resolved
* | ||
* <p>If there are no configurations, Retries have the default max retry delay value set above | ||
* and LROs have a default max poll retry delay value of {@code Duration.ofMillis(45000)} (45 | ||
* seconds). | ||
*/ | ||
public abstract Builder setMaxRetryDelay(Duration maxDelay); | ||
|
||
/** | ||
* MaxAttempts defines the maximum number of attempts to perform. The default value is {@code | ||
* 0}. If this value is greater than 0, and the number of attempts reaches this limit, the logic |
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 remember that both 0 and 1 mean there is no retry from a YAQS. It's kind of already implied as maxAttempts
should include the first attempt, can you please make it clear in the comment here to reduce similar confusion in the future?
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.
Updated. Let me know if this makes more 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.
The first attempt will be considered attempt #0.
I think this is true if maxAttempts
is set to 0, but The first attempt will be considered attempt #1
if maxAttempts
is set to 1?
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.
The first attempt will be set as Attempt #0 (
Line 104 in 80f23ec
.setAttemptCount(0) |
nextAttempt
class and update the attemptCount: Line 164 in 80f23ec
.setAttemptCount(previousSettings.getAttemptCount() + 1) |
Lines 224 to 226 in 80f23ec
if (maxAttempts > 0 && nextAttemptSettings.getAttemptCount() >= maxAttempts) { | |
return false; | |
} |
I think it would make sense if I specify that maxAttempts refers to the number of retry attempts instead.
[gapic-generator-java-root] Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
[java_showcase_integration_tests] Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Thank you for opening a Pull Request! For general contributing guidelines, please refer to contributing guide
Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #2214