1996fanrui commented on code in PR #808:
URL:
https://github.com/apache/flink-kubernetes-operator/pull/808#discussion_r1542554907
##########
flink-autoscaler/src/main/java/org/apache/flink/autoscaler/event/AutoScalerEventHandler.java:
##########
@@ -63,6 +65,19 @@ void handleEvent(
@Nullable String messageKey,
@Nullable Duration interval);
+ /**
+ * Handle exception, and the exception event is warning type and don't
deduplicate by default.
+ */
+ default void handleException(Context context, String reason, Throwable e) {
+ var message = e.getMessage();
+ if (message == null) {
+ var stream = new ByteArrayOutputStream();
+ e.printStackTrace(new PrintStream(stream));
+ message = stream.toString();
Review Comment:
Thanks @gyfora for the quick review and good suggestion!
> Can be replaced with ExceptionUtils.getStackTrace(e) from apache commons
or ExceptionUtis.stringifyException from flink utils
Done~
> we should also set some reasonable (relatively small) limit on the string
size here otherwise we might get an error when inserting the Kube event / db
column
I saw the default value of
`kubernetes.operator.exception.stacktrace.max.length` is 2048, so I use it here.
And I didn't extract an autoscaler option for it unless it's needed in the
future.
--
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]