fix:remove the secondary report. (#900)

pull/920/head
Haotian Zhang 2 years ago committed by GitHub
parent e1ab8b070d
commit 2d9afcc4fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,3 +2,4 @@
---
- [fix: fix log feign response stream close bug.](https://github.com/Tencent/spring-cloud-tencent/pull/896)
- [fix:remove the secondary report.](https://github.com/Tencent/spring-cloud-tencent/pull/900)

@ -46,7 +46,7 @@ public class ExceptionPolarisReporter implements EnhancedFeignPlugin {
private final ConsumerAPI consumerAPI;
public ExceptionPolarisReporter(RpcEnhancementReporterProperties reporterProperties,
ConsumerAPI consumerAPI) {
ConsumerAPI consumerAPI) {
this.reporterProperties = reporterProperties;
this.consumerAPI = consumerAPI;
}
@ -75,12 +75,10 @@ public class ExceptionPolarisReporter implements EnhancedFeignPlugin {
if (exception instanceof SocketTimeoutException) {
retStatus = RetStatus.RetTimeout;
}
LOG.debug("Will report result of {}. Request=[{} {}]. Response=[{}].", retStatus.name(), request.httpMethod().name(), request.url(), response.status());
LOG.debug("Will report result of {}. Request=[{} {}]. Response=[{}].", retStatus.name(), request.httpMethod()
.name(), request.url(), response.status());
ServiceCallResult resultRequest = ReporterUtils.createServiceCallResult(request, retStatus);
consumerAPI.updateServiceCallResult(resultRequest);
// update result without method for service circuit break.
resultRequest.setMethod("");
consumerAPI.updateServiceCallResult(resultRequest);
}
}

@ -72,12 +72,10 @@ public class SuccessPolarisReporter extends AbstractPolarisReporterAdapter imple
if (apply(HttpStatus.resolve(response.status()))) {
retStatus = RetStatus.RetFail;
}
LOG.debug("Will report result of {}. Request=[{} {}]. Response=[{}].", retStatus.name(), request.httpMethod().name(), request.url(), response.status());
LOG.debug("Will report result of {}. Request=[{} {}]. Response=[{}].", retStatus.name(), request.httpMethod()
.name(), request.url(), response.status());
ServiceCallResult resultRequest = ReporterUtils.createServiceCallResult(request, retStatus);
consumerAPI.updateServiceCallResult(resultRequest);
// update result without method for service circuit break.
resultRequest.setMethod("");
consumerAPI.updateServiceCallResult(resultRequest);
}
}

@ -153,9 +153,6 @@ public class EnhancedRestTemplateReporter extends AbstractPolarisReporterAdapter
LOGGER.debug("Will report result of {}. URL=[{}]. Response=[{}].", resultRequest.getRetStatus().name(),
url, response);
consumerAPI.updateServiceCallResult(resultRequest);
// update result without method for service circuit break.
resultRequest.setMethod("");
consumerAPI.updateServiceCallResult(resultRequest);
}
catch (Exception e) {
LOGGER.error("RestTemplate response reporter execute failed of {} url {}", response, url, e);

@ -147,7 +147,7 @@ public class EnhancedRestTemplateReporterTest {
URI uri = mock(URI.class);
enhancedRestTemplateReporter.handleError(uri, HttpMethod.GET, response);
verify(consumerAPI, times(2)).updateServiceCallResult(any());
verify(consumerAPI, times(1)).updateServiceCallResult(any());
verify(delegate).handleError(uri, HttpMethod.GET, response);
}
@ -162,7 +162,7 @@ public class EnhancedRestTemplateReporterTest {
URI uri = mock(URI.class);
enhancedRestTemplateReporter.handleError(uri, HttpMethod.GET, response);
verify(consumerAPI, times(2)).updateServiceCallResult(any());
verify(consumerAPI, times(1)).updateServiceCallResult(any());
verify(delegate, times(0)).handleError(uri, HttpMethod.GET, response);
}

Loading…
Cancel
Save