hejufang commented on code in PR #25837:
URL: https://github.com/apache/flink/pull/25837#discussion_r2041481502


##########
flink-runtime/src/main/java/org/apache/flink/runtime/state/metrics/MetricsTrackingAggregatingState.java:
##########
@@ -89,26 +110,29 @@ public void updateInternal(ACC valueToStore) throws 
Exception {
 
     @Override
     public void mergeNamespaces(N target, Collection<N> sources) throws 
Exception {
-        if (latencyTrackingStateMetric.trackLatencyOnMergeNamespace()) {
+        if (latencyTrackingStateMetric != null
+                && latencyTrackingStateMetric.trackMetricsOnMergeNamespace()) {
             trackLatencyWithException(
                     () -> original.mergeNamespaces(target, sources),
-                    
AggregatingStateLatencyMetrics.AGGREGATING_STATE_MERGE_NAMESPACES_LATENCY);
+                    
AggregatingStateMetrics.AGGREGATING_STATE_MERGE_NAMESPACES_LATENCY);
         } else {
             original.mergeNamespaces(target, sources);
         }
     }
 
-    static class AggregatingStateLatencyMetrics extends StateLatencyMetricBase 
{
+    static class AggregatingStateMetrics extends StateMetricBase {
         private static final String AGGREGATING_STATE_GET_LATENCY = 
"aggregatingStateGetLatency";
         private static final String AGGREGATING_STATE_ADD_LATENCY = 
"aggregatingStateAddLatency";
         private static final String AGGREGATING_STATE_MERGE_NAMESPACES_LATENCY 
=
                 "aggregatingStateMergeNamespacesLatency";
+        private static final String AGGREGATING_STATE_GET_KEY_SIZE = 
"aggregatingStateGetKeySize";
+        private static final String AGGREGATING_STATE_ADD_KEY_SIZE = 
"aggregatingStateAddKeySize";

Review Comment:
   The result returned by the AggregatingState#get is the output processed by 
the user-defined AggregateFunction. At this stage, the returned data cannot be 
serialized using the valueSerializer to calculate its size, so I didn’t include 
the size of the AggregatingState's value in the statistics. WDYT?



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to