[Spring-Cloud-Alibaba] Sentinel 整合RestTemplate & Feign
Sentinel API Github : WIKI Sphu (指明要保护的资源名称) Tracer (指明调用来源,异常统计接口) ContextUtil(标示进入调用链入口) 流控规则(针对来源属性) @GetMapping("/test-sentinel-api") public String testSentinelAPI(@RequestParam(required = false) String a) { String resourceName = "test-sentinel-api"; ContextUtil.enter(resourceName, "user-center-service"); // 定义一个sentinel 保护的资源,名称是test-sentinel-api Entry entry = null; try { entry = SphU.entry(resourceName); // ...被保护的业务逻辑处理 if (StringUtils.isEmpty(a)) { // Sentinel 默认只会统计BlockException & BlockException的子类,如果想统计其他异常信息,添加Tracer throw new IllegalArgumentException("A is not empty."); } return a