Skip to content

Commit 736abfa

Browse files
authored
chore: remove redundant stacktraces from logs (#184)
1 parent 03ee011 commit 736abfa

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

src/main/java/com/epam/aidial/deployment/manager/service/deployment/DeploymentLogsService.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
1515

1616
import java.io.IOException;
17+
import java.nio.channels.ClosedByInterruptException;
1718
import java.util.concurrent.ExecutorService;
1819

1920
@Slf4j
@@ -66,14 +67,19 @@ private SafeAutoCloseable startPodStreaming(String id,
6667
.name("logs")
6768
.data(line));
6869
} catch (IOException e) {
69-
log.error("Failed to send log line. Deployment {}", id, e);
70+
log.warn("Failed to send log line. Deployment {}", id, e);
7071
emitter.completeWithError(e);
7172
}
7273
}
7374
});
7475
emitter.complete();
7576
} catch (Exception e) {
76-
log.error("Failed to read logs for deployment {}", id, e);
77+
String message = "Failed to read logs for deployment " + id;
78+
if (e instanceof ClosedByInterruptException) {
79+
log.warn("{}. Reason: ClosedByInterruptException", message);
80+
} else {
81+
log.warn(message, e);
82+
}
7783
emitter.completeWithError(e);
7884
}
7985
});

src/main/java/com/epam/aidial/deployment/manager/service/deployment/healthcheck/McpHealthChecker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public void waitReady(String serviceUrl, Deployment deployment, Duration timeout
5252
}
5353
});
5454
} catch (RuntimeException e) {
55-
throw new IllegalStateException("MCP service failed to become ready at URL: " + serviceUrl, e);
55+
throw new IllegalStateException("MCP service failed to become ready at URL: %s. Reason: %s".formatted(serviceUrl, e.getMessage()));
5656
}
5757
log.debug("MCP service is ready at URL: {}", serviceUrl);
5858
}

src/test/java/com/epam/aidial/deployment/manager/service/deployment/healthcheck/McpHealthCheckerTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ void waitReady_shouldThrowIllegalStateExceptionWhenClientInitializationFails() {
124124
);
125125

126126
assertThat(exception)
127-
.hasMessageContaining("MCP service failed to become ready at URL: " + SERVICE_URL)
128-
.hasCause(initializationException);
127+
.hasMessageContaining("MCP service failed to become ready at URL: %s. Reason: %s".formatted(SERVICE_URL, "Connection failed"));
129128
verify(retryTemplateFactory).apply(TIMEOUT);
130129
verify(mcpEndpointPathResolver).resolveEndpointPath(mcpDeployment);
131130
}

0 commit comments

Comments
 (0)