weiqingy commented on code in PR #609:
URL: https://github.com/apache/flink-agents/pull/609#discussion_r3094888844


##########
runtime/src/main/java/org/apache/flink/agents/runtime/operator/ActionExecutionOperator.java:
##########
@@ -342,6 +342,10 @@ private void initEventLogger(StreamingRuntimeContext 
runtimeContext) throws Exce
             return;
         }
         eventLogger.open(new EventLoggerOpenParams(runtimeContext));
+        if (eventLogger instanceof FileEventLogger) {

Review Comment:
   The `instanceof` check is needed because `setTruncatedEventsCounter()` is 
specific to `FileEventLogger` — it's not on the `EventLogger` interface. The 
truncation counter is registered centrally in `BuiltInMetrics` (alongside 
`numOfEventProcessed`, `numOfActionsExecuted`, etc.) so all operator metrics 
live in one place under the same `FlinkAgentsMetricGroupImpl` hierarchy. The 
operator then passes the counter reference to `FileEventLogger` after `open()`.
   
   We considered adding the counter to the `EventLogger` interface or having 
the logger self-register, but both options would either leak Flink metrics 
concerns into the public API or break the centralized metrics pattern. The 
`instanceof` check keeps the interface clean while allowing `FileEventLogger` 
to participate in the operator's metrics.
   
   Open to suggestions if you'd prefer a different approach here.
   



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