FrankChen021 commented on code in PR #20832:
URL: https://github.com/apache/druid/pull/20832#discussion_r4476283536
##########
server/src/main/java/org/apache/druid/server/QueryLifecycle.java:
##########
@@ -611,4 +613,34 @@ public static boolean shouldLogStackTrace(final Throwable
e, final QueryContext
return false;
}
}
+
+ /**
+ * Returns whether the exception is an error the user caused and can fix
themselves, such as invalid SQL or an
+ * unknown table. The client already receives these in the response, and
they are recorded in the request log and
+ * query metrics, so they don't need a WARN in the server log.
+ *
+ * The persona alone is not enough: {@link DruidException.Persona#USER}
exceptions are also raised for timeouts,
+ * capacity limits and runtime failures that may need operator attention. So
only categories describing a problem
+ * with the request itself are considered user errors.
+ *
+ * @param e exception
+ */
+ public static boolean isUserError(final Throwable e)
+ {
+ if (!(e instanceof DruidException)) {
+ return false;
+ }
+ final DruidException de = (DruidException) e;
+ if (de.getTargetPersona() != DruidException.Persona.USER) {
+ return false;
+ }
+ switch (de.getCategory()) {
+ case INVALID_INPUT:
+ case NOT_FOUND:
+ case UNSUPPORTED:
Review Comment:
Fixed in 8febb8d739. The missing `druid-catalog` error only an operator can
fix, so it now targets `OPERATOR` and stays at WARN. The other
`USER`/`UNSUPPORTED` sites are all problems with the request itself.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]