mirror of
https://github.com/didi/KnowStreaming.git
synced 2025-12-24 11:52:08 +08:00
Connect相关代码
This commit is contained in:
@@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -30,6 +31,14 @@ public class KafkaHealthController {
|
||||
@Autowired
|
||||
private HealthStateService healthStateService;
|
||||
|
||||
private List<Integer> allDimensionCodeList = new ArrayList<Integer>() {
|
||||
{
|
||||
for (HealthCheckDimensionEnum dimensionEnum : HealthCheckDimensionEnum.values()) {
|
||||
add(dimensionEnum.getDimension());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Autowired
|
||||
private HealthCheckResultService healthCheckResultService;
|
||||
|
||||
@@ -40,11 +49,21 @@ public class KafkaHealthController {
|
||||
@RequestParam(required = false) Integer dimensionCode) {
|
||||
HealthCheckDimensionEnum dimensionEnum = HealthCheckDimensionEnum.getByCode(dimensionCode);
|
||||
if (!dimensionEnum.equals(HealthCheckDimensionEnum.UNKNOWN)) {
|
||||
return Result.buildSuc(HealthScoreVOConverter.convert2HealthScoreResultDetailVOList(healthStateService.getDimensionHealthResult(clusterPhyId, dimensionEnum)));
|
||||
return Result.buildSuc(HealthScoreVOConverter.convert2HealthScoreResultDetailVOList(healthStateService.getDimensionHealthResult(clusterPhyId, Arrays.asList(dimensionCode))));
|
||||
}
|
||||
|
||||
return Result.buildSuc(HealthScoreVOConverter.convert2HealthScoreResultDetailVOList(
|
||||
healthStateService.getClusterHealthResult(clusterPhyId)
|
||||
healthStateService.getDimensionHealthResult(clusterPhyId, allDimensionCodeList)
|
||||
));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "集群-健康检查详情")
|
||||
@PostMapping(value = "clusters/{clusterPhyId}/health-detail")
|
||||
@ResponseBody
|
||||
public Result<List<HealthScoreResultDetailVO>> getClusterHealthCheckResultDetail(@PathVariable Long clusterPhyId,
|
||||
@RequestBody List<Integer> dimensionCodeList) {
|
||||
return Result.buildSuc(HealthScoreVOConverter.convert2HealthScoreResultDetailVOList(
|
||||
healthStateService.getDimensionHealthResult(clusterPhyId, dimensionCodeList)
|
||||
));
|
||||
}
|
||||
|
||||
@@ -55,7 +74,7 @@ public class KafkaHealthController {
|
||||
@PathVariable Integer dimensionCode,
|
||||
@PathVariable String resName) {
|
||||
return Result.buildSuc(HealthScoreVOConverter.convert2HealthScoreBaseResultVOList(
|
||||
healthStateService.getResHealthResult(clusterPhyId, dimensionCode, resName)
|
||||
healthStateService.getResHealthResult(clusterPhyId, clusterPhyId, dimensionCode, resName)
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,19 @@ public class VersionController {
|
||||
@GetMapping(value = "support-kafka-versions")
|
||||
@ResponseBody
|
||||
public Result<SortedMap<String, Long>> listAllVersions() {
|
||||
Result<Map<String, Long>> rm = versionControlManager.listAllVersions();
|
||||
Result<Map<String, Long>> rm = versionControlManager.listAllKafkaVersions();
|
||||
if (rm.failed()) {
|
||||
return Result.buildFromIgnoreData(rm);
|
||||
}
|
||||
|
||||
return Result.buildSuc(new TreeMap<>(rm.getData()));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "支持的kafka-Connect版本列表", notes = "")
|
||||
@GetMapping(value = "support-kafka-connect-versions")
|
||||
@ResponseBody
|
||||
public Result<SortedMap<String, Long>> listAllConnectVersions() {
|
||||
Result<Map<String, Long>> rm = versionControlManager.listAllKafkaVersions();
|
||||
if (rm.failed()) {
|
||||
return Result.buildFromIgnoreData(rm);
|
||||
}
|
||||
@@ -54,7 +66,7 @@ public class VersionController {
|
||||
@GetMapping(value = "clusters/{clusterId}/types/{type}/support-kafka-versions")
|
||||
@ResponseBody
|
||||
public Result<List<VersionItemVO>> listClusterVersionControlItem(@PathVariable Long clusterId, @PathVariable Integer type) {
|
||||
return versionControlManager.listClusterVersionControlItem(clusterId, type);
|
||||
return versionControlManager.listKafkaClusterVersionControlItem(clusterId, type);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "用户设置的指标显示项", notes = "")
|
||||
|
||||
@@ -10,8 +10,6 @@ import com.xiaojukeji.know.streaming.km.common.bean.entity.metrics.ZookeeperMetr
|
||||
import com.xiaojukeji.know.streaming.km.core.service.zookeeper.ZookeeperMetricService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -26,8 +24,6 @@ import java.util.List;
|
||||
@RestController
|
||||
@RequestMapping(ApiPrefix.API_V3_PREFIX)
|
||||
public class ZookeeperMetricsController {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ZookeeperMetricsController.class);
|
||||
|
||||
@Autowired
|
||||
private ZookeeperMetricService zookeeperMetricService;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user