fix:remove the secondary report. (#899)

pull/909/head
Haotian Zhang 2 years ago committed by GitHub
parent 866f4e9f5d
commit 93c85ec3cc
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/897)
- [fix:remove the secondary report.](https://github.com/Tencent/spring-cloud-tencent/pull/899)

@ -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);

@ -146,7 +146,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);
}
@ -161,7 +161,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