core: Include wait-for-ready in deadline exceeded insights

There was a report from a user in b/176088054 that experienced an RPC
waiting_for_connection that failed after 45 minutes due to deadline.
That would be quite normal for wait-for-ready, but because we didn't
include that detail in the status we have to do code inspection to
determine if wait-for-ready was enabled.
This commit is contained in:
Eric Anderson 2020-12-23 12:52:53 -08:00 committed by Eric Anderson
parent b3899087d0
commit 20197d36ce
2 changed files with 20 additions and 0 deletions

View File

@ -375,5 +375,13 @@ final class DelayedClientTransport implements ManagedClientTransport {
}
syncContext.drain();
}
@Override
public void appendTimeoutInsight(InsightBuilder insight) {
if (args.getCallOptions().isWaitForReady()) {
insight.append("wait_for_ready");
}
super.appendTimeoutInsight(insight);
}
}
}

View File

@ -16,6 +16,7 @@
package io.grpc.internal;
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
@ -600,6 +601,17 @@ public class DelayedClientTransportTest {
verify(transportListener).transportInUse(true);
}
@Test
public void pendingStream_appendTimeoutInsight_waitForReady() {
ClientStream stream = delayedTransport.newStream(
method, headers, callOptions.withWaitForReady());
stream.start(streamListener);
InsightBuilder insight = new InsightBuilder();
stream.appendTimeoutInsight(insight);
assertThat(insight.toString())
.matches("\\[wait_for_ready, buffered_nanos=[0-9]+\\, waiting_for_connection]");
}
private static TransportProvider newTransportProvider(final ClientTransport transport) {
return new TransportProvider() {
@Override