mxm commented on code in PR #941: URL: https://github.com/apache/flink-kubernetes-operator/pull/941#discussion_r1943201542
########## flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/service/AbstractFlinkService.java: ########## @@ -757,16 +778,35 @@ public Map<String, String> getClusterInfo(Configuration conf) throws Exception { DashboardConfiguration.FIELD_NAME_FLINK_REVISION, dashboardConfiguration.getFlinkRevision()); } + } - var taskManagerReplicas = getTaskManagersInfo(conf).getTaskManagerInfos().size(); - clusterInfo.put( - FIELD_NAME_TOTAL_CPU, - String.valueOf(FlinkUtils.calculateClusterCpuUsage(conf, taskManagerReplicas))); - clusterInfo.put( - FIELD_NAME_TOTAL_MEMORY, - String.valueOf(FlinkUtils.calculateClusterMemoryUsage(conf, taskManagerReplicas))); + private void populateStateSize( + Configuration conf, @Nullable String jobId, Map<String, String> clusterInfo) + throws Exception { + if (jobId != null) { + try (RestClusterClient<String> clusterClient = getClusterClient(conf)) { + var checkpointingStatisticsHeaders = CheckpointingStatisticsHeaders.getInstance(); + var parameters = checkpointingStatisticsHeaders.getUnresolvedMessageParameters(); + parameters.jobPathParameter.resolve(JobID.fromHexString(jobId)); - return clusterInfo; + CheckpointingStatistics checkpointingStatistics = + clusterClient + .sendRequest( + checkpointingStatisticsHeaders, + parameters, + EmptyRequestBody.getInstance()) + .get(); + CheckpointStatistics.CompletedCheckpointStatistics completedCheckpointStatistics = + checkpointingStatistics + .getLatestCheckpoints() + .getCompletedCheckpointStatistics(); + if (completedCheckpointStatistics != null) { + clusterInfo.put( + FIELD_NAME_STATE_SIZE, + String.valueOf(completedCheckpointStatistics.getCheckpointedSize())); Review Comment: Perfect, then the PR is good as-is. -- 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