apache / paimon-webui

Web ui for Apache Paimon.
https://paimon.apache.org/
Apache License 2.0
121 stars 58 forks source link

[Feature] Add cluster status check interface and scheduled tasks #453

Closed AnemoneIndicum closed 2 months ago

AnemoneIndicum commented 2 months ago

Purpose

close: https://github.com/apache/paimon-webui/issues/317

Tests

API and Format

  @SaCheckPermission("system:cluster:check")
    @PostMapping("/check")
    public R<Void> check(@Validated @RequestBody ClusterInfo clusterInfo) {
        return clusterService.checkClusterHeartbeatStatus(clusterInfo) ? R.succeed() : R.failed();
    }

/** Using to execute cluster heartbeat action. */
public interface HeartbeatAction {

    /**
     * Execute cluster action to obtain cluster status.
     *
     * @return cluster heartbeat entity.
     */
    HeartbeatEntity checkClusterHeartbeat();

    /**
     * Build a heartbeat entity representing an error based on the cluster status. This method is
     * used to generate a heartbeat object when the cluster status is abnormal, recording the
     * current time and the error status of the cluster.
     *
     * @param status The current status of the cluster, used to set the status field of the
     *     heartbeat entity.
     * @return Returns a completed heartbeat entity, including the current timestamp and status
     *     information.
     */
    default HeartbeatEntity buildResulHeartbeatEntity(HeartbeatStatus status) {
        return HeartbeatEntity.builder().status(status.name()).build();
    }
}