fix: fix log feign response stream close bug (#898)

pull/901/head
Shanyou Yu (Sean Yu) 2 years ago committed by GitHub
parent b808dc8c0f
commit 8c88a92c45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,3 +1,4 @@
# Change Log
---
- [fix: fix log feign response stream close bug.](https://github.com/Tencent/spring-cloud-tencent/pull/898)

@ -75,7 +75,7 @@ public class ExceptionPolarisReporter implements EnhancedFeignPlugin {
if (exception instanceof SocketTimeoutException) {
retStatus = RetStatus.RetTimeout;
}
LOG.debug("Will report result of {}. Request=[{}]. Response=[{}].", retStatus.name(), request, response);
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.

@ -72,7 +72,7 @@ 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, response);
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.

@ -17,6 +17,8 @@
package com.tencent.cloud.rpc.enhancement.feign.plugin.reporter;
import java.util.HashMap;
import com.tencent.cloud.rpc.enhancement.config.RpcEnhancementReporterProperties;
import com.tencent.cloud.rpc.enhancement.feign.plugin.EnhancedFeignContext;
import com.tencent.cloud.rpc.enhancement.feign.plugin.EnhancedFeignPluginType;
@ -83,7 +85,7 @@ public class ExceptionPolarisReporterTest {
@Test
public void testRun() {
// mock request
Request request = mock(Request.class);
Request request = Request.create(Request.HttpMethod.GET, "/", new HashMap<>(), null, null, null);
// mock response
Response response = mock(Response.class);

@ -17,6 +17,8 @@
package com.tencent.cloud.rpc.enhancement.feign.plugin.reporter;
import java.util.HashMap;
import com.tencent.cloud.rpc.enhancement.config.RpcEnhancementReporterProperties;
import com.tencent.cloud.rpc.enhancement.feign.plugin.EnhancedFeignContext;
import com.tencent.cloud.rpc.enhancement.feign.plugin.EnhancedFeignPluginType;
@ -83,7 +85,7 @@ public class SuccessPolarisReporterTest {
@Test
public void testRun() {
// mock request
Request request = mock(Request.class);
Request request = Request.create(Request.HttpMethod.GET, "/", new HashMap<>(), null, null, null);
// mock response
Response response = mock(Response.class);
doReturn(502).when(response).status();

Loading…
Cancel
Save