fix:fix gray release examples bug. (#1067)

pull/1070/head
Haotian Zhang 1 year ago committed by GitHub
parent b63d50dc6a
commit 62eea957bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -20,3 +20,4 @@
- [refactor:refactor Polaris registration.](https://github.com/Tencent/spring-cloud-tencent/pull/1056) - [refactor:refactor Polaris registration.](https://github.com/Tencent/spring-cloud-tencent/pull/1056)
- [feat:added automatic optimization for dynamic config refresh type.](https://github.com/Tencent/spring-cloud-tencent/pull/1059) - [feat:added automatic optimization for dynamic config refresh type.](https://github.com/Tencent/spring-cloud-tencent/pull/1059)
- [fix:fix SCG report wrong service bug when using IP routing.](https://github.com/Tencent/spring-cloud-tencent/pull/1064) - [fix:fix SCG report wrong service bug when using IP routing.](https://github.com/Tencent/spring-cloud-tencent/pull/1064)
- [fix:fix gray release examples bug.](https://github.com/Tencent/spring-cloud-tencent/pull/1067)

@ -21,6 +21,7 @@ package com.tencent.cloud.polaris.router.grayrelease.front;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@ -39,11 +40,11 @@ public class FrontController {
* @return information of callee * @return information of callee
*/ */
@GetMapping("/rest") @GetMapping("/rest")
public String rest() { public String rest(@RequestHeader("uid") int user) {
String env = System.getenv("SCT_METADATA_CONTENT_env"); String env = System.getenv("SCT_METADATA_CONTENT_env");
String appName = environment.getProperty("spring.application.name"); String appName = environment.getProperty("spring.application.name");
String curName = appName + "[" + env + "]"; String curName = appName + "[" + env + "]";
String resp = routerService.rest(); String resp = routerService.rest(user);
return curName + " -> " + resp; return curName + " -> " + resp;
} }
} }

@ -20,6 +20,7 @@ package com.tencent.cloud.polaris.router.grayrelease.front;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
/** /**
* Router callee feign client. * Router callee feign client.
@ -30,6 +31,6 @@ import org.springframework.web.bind.annotation.GetMapping;
public interface RouterService { public interface RouterService {
@GetMapping("/router/gray/rest") @GetMapping("/router/gray/rest")
String rest(); String rest(@RequestHeader("uid") int user);
} }

@ -21,6 +21,7 @@ package com.tencent.cloud.polaris.router.grayrelease.middle;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@ -39,11 +40,11 @@ public class MiddleController {
* @return information of callee * @return information of callee
*/ */
@GetMapping("/rest") @GetMapping("/rest")
public String rest() { public String rest(@RequestHeader("uid") int user) {
String env = System.getenv("SCT_METADATA_CONTENT_env"); String env = System.getenv("SCT_METADATA_CONTENT_env");
String appName = environment.getProperty("spring.application.name"); String appName = environment.getProperty("spring.application.name");
String curName = appName + "[" + env + "]"; String curName = appName + "[" + env + "]";
String resp = routerService.rest(); String resp = routerService.rest(user);
return curName + " -> " + resp; return curName + " -> " + resp;
} }
} }

@ -20,6 +20,7 @@ package com.tencent.cloud.polaris.router.grayrelease.middle;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
/** /**
* Router callee feign client. * Router callee feign client.
@ -30,6 +31,6 @@ import org.springframework.web.bind.annotation.GetMapping;
public interface RouterService { public interface RouterService {
@GetMapping("/router/gray/rest") @GetMapping("/router/gray/rest")
String rest(); String rest(@RequestHeader("uid") int user);
} }

Loading…
Cancel
Save