@Test public void testRt4Service() { }
@RequestMapping("/rt/service") public ObjectNode rt4Service(HttpServletRequest request) { String namespaceId = WebUtils.optional(request, CommonParams.NAMESPACE_ID, Constants.DEFAULT_NAMESPACE_ID); String serviceName = WebUtils.required(request, CommonParams.SERVICE_NAME); Service service = serviceManager.getService(namespaceId, serviceName); if (service == null) { throw new IllegalArgumentException("request service doesn't exist"); } ObjectNode result = JacksonUtils.createEmptyJsonNode(); ArrayNode clusters = JacksonUtils.createEmptyArrayNode(); for (Map.Entry<String, com.alibaba.nacos.naming.core.Cluster> entry : service.getClusterMap().entrySet()) { ObjectNode packet = JacksonUtils.createEmptyJsonNode(); HealthCheckTask task = entry.getValue().getHealthCheckTask(); packet.put("name", entry.getKey()); packet.put("checkRTBest", task.getCheckRtBest()); packet.put("checkRTWorst", task.getCheckRtWorst()); packet.put("checkRTNormalized", task.getCheckRtNormalized()); clusters.add(packet); } result.replace("clusters", clusters); return result; }
CatalogController { @RequestMapping("/rt/service") public ObjectNode rt4Service(HttpServletRequest request) { String namespaceId = WebUtils.optional(request, CommonParams.NAMESPACE_ID, Constants.DEFAULT_NAMESPACE_ID); String serviceName = WebUtils.required(request, CommonParams.SERVICE_NAME); Service service = serviceManager.getService(namespaceId, serviceName); if (service == null) { throw new IllegalArgumentException("request service doesn't exist"); } ObjectNode result = JacksonUtils.createEmptyJsonNode(); ArrayNode clusters = JacksonUtils.createEmptyArrayNode(); for (Map.Entry<String, com.alibaba.nacos.naming.core.Cluster> entry : service.getClusterMap().entrySet()) { ObjectNode packet = JacksonUtils.createEmptyJsonNode(); HealthCheckTask task = entry.getValue().getHealthCheckTask(); packet.put("name", entry.getKey()); packet.put("checkRTBest", task.getCheckRtBest()); packet.put("checkRTWorst", task.getCheckRtWorst()); packet.put("checkRTNormalized", task.getCheckRtNormalized()); clusters.add(packet); } result.replace("clusters", clusters); return result; } }
CatalogController { @RequestMapping("/rt/service") public ObjectNode rt4Service(HttpServletRequest request) { String namespaceId = WebUtils.optional(request, CommonParams.NAMESPACE_ID, Constants.DEFAULT_NAMESPACE_ID); String serviceName = WebUtils.required(request, CommonParams.SERVICE_NAME); Service service = serviceManager.getService(namespaceId, serviceName); if (service == null) { throw new IllegalArgumentException("request service doesn't exist"); } ObjectNode result = JacksonUtils.createEmptyJsonNode(); ArrayNode clusters = JacksonUtils.createEmptyArrayNode(); for (Map.Entry<String, com.alibaba.nacos.naming.core.Cluster> entry : service.getClusterMap().entrySet()) { ObjectNode packet = JacksonUtils.createEmptyJsonNode(); HealthCheckTask task = entry.getValue().getHealthCheckTask(); packet.put("name", entry.getKey()); packet.put("checkRTBest", task.getCheckRtBest()); packet.put("checkRTWorst", task.getCheckRtWorst()); packet.put("checkRTNormalized", task.getCheckRtNormalized()); clusters.add(packet); } result.replace("clusters", clusters); return result; }  }
CatalogController { @RequestMapping("/rt/service") public ObjectNode rt4Service(HttpServletRequest request) { String namespaceId = WebUtils.optional(request, CommonParams.NAMESPACE_ID, Constants.DEFAULT_NAMESPACE_ID); String serviceName = WebUtils.required(request, CommonParams.SERVICE_NAME); Service service = serviceManager.getService(namespaceId, serviceName); if (service == null) { throw new IllegalArgumentException("request service doesn't exist"); } ObjectNode result = JacksonUtils.createEmptyJsonNode(); ArrayNode clusters = JacksonUtils.createEmptyArrayNode(); for (Map.Entry<String, com.alibaba.nacos.naming.core.Cluster> entry : service.getClusterMap().entrySet()) { ObjectNode packet = JacksonUtils.createEmptyJsonNode(); HealthCheckTask task = entry.getValue().getHealthCheckTask(); packet.put("name", entry.getKey()); packet.put("checkRTBest", task.getCheckRtBest()); packet.put("checkRTWorst", task.getCheckRtWorst()); packet.put("checkRTNormalized", task.getCheckRtNormalized()); clusters.add(packet); } result.replace("clusters", clusters); return result; }  @Secured(parser = NamingResourceParser.class, action = ActionTypes.READ) @GetMapping("/service") ObjectNode serviceDetail(@RequestParam(defaultValue = Constants.DEFAULT_NAMESPACE_ID) String namespaceId,
            String serviceName); @Secured(parser = NamingResourceParser.class, action = ActionTypes.READ) @RequestMapping(value = "/instances") ObjectNode instanceList(@RequestParam(defaultValue = Constants.DEFAULT_NAMESPACE_ID) String namespaceId,
            @RequestParam String serviceName, @RequestParam String clusterName, @RequestParam(name = "pageNo") int page,
            @RequestParam int pageSize); @Secured(parser = NamingResourceParser.class, action = ActionTypes.READ) @GetMapping("/services") Object listDetail(@RequestParam(required = false) boolean withInstances,
            @RequestParam(defaultValue = Constants.DEFAULT_NAMESPACE_ID) String namespaceId,
            @RequestParam(required = false) int pageNo, @RequestParam(required = false) int pageSize,
            @RequestParam(name = "serviceNameParam", defaultValue = StringUtils.EMPTY) String serviceName,
            @RequestParam(name = "groupNameParam", defaultValue = StringUtils.EMPTY) String groupName,
            @RequestParam(name = "instance", defaultValue = StringUtils.EMPTY) String containedInstance,
            @RequestParam(required = false) boolean hasIpCount); @RequestMapping("/rt/service") ObjectNode rt4Service(HttpServletRequest request); }
CatalogController { @RequestMapping("/rt/service") public ObjectNode rt4Service(HttpServletRequest request) { String namespaceId = WebUtils.optional(request, CommonParams.NAMESPACE_ID, Constants.DEFAULT_NAMESPACE_ID); String serviceName = WebUtils.required(request, CommonParams.SERVICE_NAME); Service service = serviceManager.getService(namespaceId, serviceName); if (service == null) { throw new IllegalArgumentException("request service doesn't exist"); } ObjectNode result = JacksonUtils.createEmptyJsonNode(); ArrayNode clusters = JacksonUtils.createEmptyArrayNode(); for (Map.Entry<String, com.alibaba.nacos.naming.core.Cluster> entry : service.getClusterMap().entrySet()) { ObjectNode packet = JacksonUtils.createEmptyJsonNode(); HealthCheckTask task = entry.getValue().getHealthCheckTask(); packet.put("name", entry.getKey()); packet.put("checkRTBest", task.getCheckRtBest()); packet.put("checkRTWorst", task.getCheckRtWorst()); packet.put("checkRTNormalized", task.getCheckRtNormalized()); clusters.add(packet); } result.replace("clusters", clusters); return result; }  @Secured(parser = NamingResourceParser.class, action = ActionTypes.READ) @GetMapping("/service") ObjectNode serviceDetail(@RequestParam(defaultValue = Constants.DEFAULT_NAMESPACE_ID) String namespaceId,
            String serviceName); @Secured(parser = NamingResourceParser.class, action = ActionTypes.READ) @RequestMapping(value = "/instances") ObjectNode instanceList(@RequestParam(defaultValue = Constants.DEFAULT_NAMESPACE_ID) String namespaceId,
            @RequestParam String serviceName, @RequestParam String clusterName, @RequestParam(name = "pageNo") int page,
            @RequestParam int pageSize); @Secured(parser = NamingResourceParser.class, action = ActionTypes.READ) @GetMapping("/services") Object listDetail(@RequestParam(required = false) boolean withInstances,
            @RequestParam(defaultValue = Constants.DEFAULT_NAMESPACE_ID) String namespaceId,
            @RequestParam(required = false) int pageNo, @RequestParam(required = false) int pageSize,
            @RequestParam(name = "serviceNameParam", defaultValue = StringUtils.EMPTY) String serviceName,
            @RequestParam(name = "groupNameParam", defaultValue = StringUtils.EMPTY) String groupName,
            @RequestParam(name = "instance", defaultValue = StringUtils.EMPTY) String containedInstance,
            @RequestParam(required = false) boolean hasIpCount); @RequestMapping("/rt/service") ObjectNode rt4Service(HttpServletRequest request);  }