-
Notifications
You must be signed in to change notification settings - Fork 104
Opencensus Tracing: Add annotations for retries #640
Conversation
This instruments the retry logic to notify the tracer of the retry lifecycle. It also fixed a bug in the ApiTracer interface that prevented exhausted retries from passing the error.
Codecov Report
@@ Coverage Diff @@
## master #640 +/- ##
============================================
+ Coverage 74.56% 74.82% +0.25%
- Complexity 949 959 +10
============================================
Files 180 181 +1
Lines 4172 4198 +26
Branches 334 335 +1
============================================
+ Hits 3111 3141 +30
+ Misses 908 904 -4
Partials 153 153
Continue to review full report at Codecov.
|
vam-google
left a comment
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.
Mostly looks good, with one real concern about the notion of cancellation in ApiTracer (see corresponding comment in BasicRetryingFuture.
| clearAttemptServiceData(); | ||
| if (throwable instanceof CancellationException) { | ||
| // An attempt triggered cancellation. | ||
| retryingContext.getTracer().attemptFailedRetriesExhausted(throwable); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| clearAttemptServiceData(); | ||
| if (throwable instanceof CancellationException) { | ||
| // An attempt triggered cancellation. | ||
| retryingContext.getTracer().attemptFailedRetriesExhausted(throwable); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| assertFutureSuccess(future); | ||
| assertEquals(0, future.getAttemptSettings().getAttemptCount()); | ||
|
|
||
| Mockito.verify(tracer, Mockito.times(1)).attemptStarted(0); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| private final String result; | ||
|
|
||
| FailingCallable(int expectedFailuresCount, String result) { | ||
| FailingCallable(ApiTracer tracer, int expectedFailuresCount, String result) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
All feedback should be addressed, PTAL |
vam-google
left a comment
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.
LGTM (with minor comment)
| // the current attempt. | ||
| // In a theoretical scenario, the attempt callable might've thrown the exception on its | ||
| // own volition. However it's currently impossible to disambiguate the 2 scenarios. | ||
| tracer.attemptCancelled(); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
Thanks for the review! |
This instruments the retry logic to notify the tracer of the retry lifecycle. It also fixed a bug in the ApiTracer interface that prevented exhausted retries from passing the error.