mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Improve logs in the GCP proxy
Tweaked a few logging levels to not spam error level logs. Also make it easy to debug issues in case relay retry fails. [1] Put non-fatal exceptions that should be logged at warning in their explicit sets. Also always use the root cause to determine if an exception is non-fatal, because sometimes the actual causes are wrapped inside other exceptions. [2] Record the cause of a relay failure, and record if a relay retry is successful. This way we can look at the log and figure out if a relay is eventually successful. [3] Add a log when the frontend connection from the client is terminated. [4] Alway close the relay channel when a relay has failed, which, depend on if the channel is frontend or backend, will reconnect and trigger a retry. [5] Lastly changed failure test to use assertThrows instead of fail. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=208649916
This commit is contained in:
parent
b552c1d115
commit
0e64015cdf
10 changed files with 154 additions and 95 deletions
|
@ -129,6 +129,8 @@ public class ProxyServer implements Runnable {
|
|||
.closeFuture()
|
||||
.addListener(
|
||||
(future) -> {
|
||||
logger.atInfo().log(
|
||||
"Connection terminated: %s %s", inboundProtocol.name(), inboundChannel);
|
||||
// Check if there's a relay connection. In case that the outbound connection
|
||||
// is not successful, this attribute is not set.
|
||||
Channel outboundChannel = inboundChannel.attr(RELAY_CHANNEL_KEY).get();
|
||||
|
@ -177,13 +179,15 @@ public class ProxyServer implements Runnable {
|
|||
Object[] messages = relayBuffer.toArray();
|
||||
relayBuffer.clear();
|
||||
for (Object msg : messages) {
|
||||
writeToRelayChannel(inboundChannel, outboundChannel, msg);
|
||||
// TODO (jianglai): do not log the message once retry behavior is confirmed.
|
||||
logger.atInfo().log(
|
||||
"Relay retried: %s <-> %s\nFRONTEND: %s\nBACKEND: %s",
|
||||
"Relay retried: %s <-> %s\nFRONTEND: %s\nBACKEND: %s\nMESSAGE: %s",
|
||||
inboundProtocol.name(),
|
||||
outboundProtocol.name(),
|
||||
inboundChannel,
|
||||
outboundChannel);
|
||||
outboundChannel,
|
||||
msg);
|
||||
writeToRelayChannel(inboundChannel, outboundChannel, msg, true);
|
||||
}
|
||||
// When this outbound connection is closed, try reconnecting if the inbound connection
|
||||
// is still active.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue