Copilot commented on code in PR #1260:
URL: 
https://github.com/apache/flink-kubernetes-operator/pull/1260#discussion_r4711429588


##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/observer/JobStatusObserver.java:
##########
@@ -408,12 +486,20 @@ private void recordJobErrorIfPresent(
                                     updateFlinkResourceException(
                                             t, ctx.getResource(), 
ctx.getOperatorConfig());
 
+                                    String message = 
ExceptionUtils.getExceptionMessage(t);
                                     eventRecorder.triggerEvent(
                                             ctx.getResource(),
                                             EventRecorder.Type.Warning,
                                             EventRecorder.Reason.Error,
+                                            truncateExceptionText(
+                                                    message,
+                                                    ctx.getOperatorConfig()
+                                                            
.getReportedExceptionEventsMaxStackTraceLength(),
+                                                    -1),
                                             EventRecorder.Component.Job,
-                                            
ExceptionUtils.getExceptionMessage(t),
+                                            // The full message tells apart 
errors that only differ
+                                            // in the truncated text
+                                            message,

Review Comment:
   Passing the uncapped message as `messageKey` still causes 
`EventUtils.generateEventName()` (`EventUtils.java:67–72`) to concatenate the 
entire error text with the resource metadata before hashing it. A 1 MiB error 
therefore creates another 1 MiB string even though its event message is capped 
at roughly 2 KiB. Pass a fixed-size hash of the full message, as the 
`JobException` path does, to retain deduplication by full text without this 
large allocation.



-- 
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]

Reply via email to