Skip to content

Commit a37a345

Browse files
ignitzChaho12
authored andcommitted
Add username info on Non OK HTTP Status code
Currently, when Trino Gateway logs non-OK HTTP status codes, such as 401 Unauthorized, it does not include information about the user who initiated the request. This lack of context makes troubleshooting difficult, as it requires manually cross-referencing timestamps with external logs (e.g., Ingress) to identify the source of the problematic requests. This change enhances the logging mechanism to include the username in the log output for these error scenarios, significantly speeding up diagnostics and reducing operational overhead.
1 parent 44a332e commit a37a345

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

gateway-ha/src/main/java/io/trino/gateway/proxyserver/ProxyRequestHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ private ProxyResponse recordBackendForQueryId(Request request, ProxyResponse res
289289
}
290290
}
291291
else {
292-
log.error("Non OK HTTP Status code with response [%s] , Status code [%s]", response.body(), response.statusCode());
292+
log.error("Non OK HTTP Status code with response [%s] , Status code [%s], user: [%s]", response.body(), response.statusCode(), username.orElse(null));
293293
}
294294
queryDetail.setRoutingGroup(routingDestination.routingGroup());
295295
queryDetail.setExternalUrl(routingDestination.externalUrl());

0 commit comments

Comments
 (0)