Merge branch 'feat_issue_818' of github.com:chuntaojun/spring-cloud-tencent into feat_issue_818

pull/924/head
chuntaojun 3 years ago
commit dfad13f8f5

@ -2,3 +2,4 @@
--- ---
- [feat:support webclient and gateway report call metrics](https://github.com/Tencent/spring-cloud-tencent/pull/924) - [feat:support webclient and gateway report call metrics](https://github.com/Tencent/spring-cloud-tencent/pull/924)
- [feature: optimize polaris-discovery-example/discovery-callee-service, add client-ip return.](https://github.com/Tencent/spring-cloud-tencent/pull/939)

@ -35,30 +35,35 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/discovery/service/callee") @RequestMapping("/discovery/service/callee")
public class DiscoveryCalleeController { public class DiscoveryCalleeController {
private static Logger LOG = LoggerFactory.getLogger(DiscoveryCalleeController.class); private static final Logger LOG = LoggerFactory.getLogger(DiscoveryCalleeController.class);
@Value("${server.port:0}") @Value("${server.port:0}")
private int port; private int port;
@Value("${spring.cloud.client.ip-address:127.0.0.1}")
private String ip;
/** /**
* Get information of callee. * Get information of callee.
*
* @return information of callee * @return information of callee
*/ */
@GetMapping("/info") @GetMapping("/info")
public String info() { public String info() {
LOG.info("Discovery Service Callee [{}] is called.", port); LOG.info("Discovery Service Callee [{}:{}] is called.", ip, port);
return String.format("Discovery Service Callee [%s] is called.", port); return String.format("Discovery Service Callee [%s:%s] is called.", ip, port);
} }
/** /**
* Get sum of two value. * Get sum of two value.
*
* @param value1 value 1 * @param value1 value 1
* @param value2 value 2 * @param value2 value 2
* @return sum * @return sum
*/ */
@GetMapping("/sum") @GetMapping("/sum")
public int sum(@RequestParam int value1, @RequestParam int value2) { public int sum(@RequestParam int value1, @RequestParam int value2) {
LOG.info("Discovery Service Callee is called and sum is {}.", value1 + value2); LOG.info("Discovery Service Callee [{}:{}] is called and sum is {}.", ip, port, value1 + value2);
return value1 + value2; return value1 + value2;
} }
} }

Loading…
Cancel
Save