Skip to content

Commit

Permalink
xds: Log ORCA UNIMPLEMENTED error to subchannel logger (#10625) (#10631)
Browse files Browse the repository at this point in the history
Logging to the static instance would result in application logs filling
up if the Orca service is not available.
We'd like to have the logging on the subchannelLogger, so we make it
visible on demand.

Also succeed Orca logging test if log message present. Using
contains over containsExactly seems more reasonable.

Co-authored-by: Yannick Epstein <yannick.epstein@gmail.com>
  • Loading branch information
ejona86 and yannickepstein committed Oct 26, 2023
1 parent 69f721f commit 4caf106
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions xds/src/main/java/io/grpc/xds/orca/OrcaOobUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@
import java.util.Map;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nullable;

/**
Expand All @@ -68,7 +66,6 @@
*/
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/9129")
public final class OrcaOobUtil {
private static final Logger logger = Logger.getLogger(OrcaPerRequestUtil.class.getName());

private OrcaOobUtil() {}

Expand Down Expand Up @@ -468,8 +465,8 @@ void handleResponse(OrcaLoadReport response) {
void handleStreamClosed(Status status) {
if (Objects.equal(status.getCode(), Code.UNIMPLEMENTED)) {
disabled = true;
logger.log(
Level.SEVERE,
subchannelLogger.log(
ChannelLogLevel.ERROR,
"Backend {0} OpenRcaService is disabled. Server returned: {1}",
new Object[] {subchannel.getAllAddresses(), status});
subchannelLogger.log(ChannelLogLevel.ERROR, "OpenRcaService disabled: {0}", status);
Expand Down
2 changes: 1 addition & 1 deletion xds/src/test/java/io/grpc/xds/orca/OrcaOobUtilTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ private static OrcaLoadReportRequest buildOrcaRequestFromConfig(
}

private static void assertLog(List<String> logs, String expectedLog) {
assertThat(logs).containsExactly(expectedLog);
assertThat(logs).contains(expectedLog);
logs.clear();
}

Expand Down

0 comments on commit 4caf106

Please sign in to comment.