feat:support circuit breaker metrics reporting. (#1524)

pull/1525/head
Haotian Zhang 5 months ago committed by GitHub
parent 364200ece8
commit fdad46b83d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -3,3 +3,4 @@
- [feat: implement circuit breaker in enhance plugin, support listen config group, support refresh single config in refresh_context mode.](https://github.com/Tencent/spring-cloud-tencent/pull/1500) - [feat: implement circuit breaker in enhance plugin, support listen config group, support refresh single config in refresh_context mode.](https://github.com/Tencent/spring-cloud-tencent/pull/1500)
- [feat:support polaris event.](https://github.com/Tencent/spring-cloud-tencent/pull/1523) - [feat:support polaris event.](https://github.com/Tencent/spring-cloud-tencent/pull/1523)
- [feat:support circuit breaker metrics reporting.](https://github.com/Tencent/spring-cloud-tencent/pull/1524)

@ -75,7 +75,7 @@ public class PolarisCircuitBreaker implements CircuitBreaker, InvokeHandler {
} }
catch (CallAbortedException e) { catch (CallAbortedException e) {
LOGGER.debug("PolarisCircuitBreaker CallAbortedException: {}", e.getMessage()); LOGGER.debug("PolarisCircuitBreaker CallAbortedException: {}", e.getMessage());
PolarisCircuitBreakerUtils.reportStatus(consumerAPI, conf, e); reportStatus(e);
return fallback.apply(e); return fallback.apply(e);
} }
catch (Exception e) { catch (Exception e) {
@ -97,4 +97,8 @@ public class PolarisCircuitBreaker implements CircuitBreaker, InvokeHandler {
public void onError(InvokeContext.ResponseContext responseContext) { public void onError(InvokeContext.ResponseContext responseContext) {
invokeHandler.onError(responseContext); invokeHandler.onError(responseContext);
} }
public void reportStatus(CallAbortedException e) {
PolarisCircuitBreakerUtils.reportStatus(consumerAPI, conf, e);
}
} }

@ -86,6 +86,7 @@ public class CircuitBreakerPlugin implements EnhancedPlugin {
} }
catch (CallAbortedException e) { catch (CallAbortedException e) {
LOG.debug("[CircuitBreakerPlugin] request is aborted. request service url=[{}]", request.getServiceUrl()); LOG.debug("[CircuitBreakerPlugin] request is aborted. request service url=[{}]", request.getServiceUrl());
polarisCircuitBreaker.reportStatus(e);
if (e.getFallbackInfo() != null) { if (e.getFallbackInfo() != null) {
Object fallbackResponse = new PolarisCircuitBreakerHttpResponse(e.getFallbackInfo()); Object fallbackResponse = new PolarisCircuitBreakerHttpResponse(e.getFallbackInfo());
putMetadataObjectValue(ContextConstant.CircuitBreaker.CIRCUIT_BREAKER_FALLBACK_HTTP_RESPONSE, fallbackResponse); putMetadataObjectValue(ContextConstant.CircuitBreaker.CIRCUIT_BREAKER_FALLBACK_HTTP_RESPONSE, fallbackResponse);

@ -52,10 +52,10 @@ public class PolarisStatProperties {
/** /**
* Push metrics interval. * Push metrics interval.
* unit: milliseconds default 30s. * unit: milliseconds default 60s.
*/ */
@Value("${spring.cloud.polaris.stat.pushgateway.push-interval:#{30000}}") @Value("${spring.cloud.polaris.stat.pushgateway.push-interval:#{60000}}")
private Long pushGatewayPushInterval = 30 * 1000L; private Long pushGatewayPushInterval = 60 * 1000L;
/** /**
* If push gateway gzip open. default false. * If push gateway gzip open. default false.

@ -69,9 +69,9 @@
{ {
"name": "spring.cloud.polaris.stat.pushgateway.push-interval", "name": "spring.cloud.polaris.stat.pushgateway.push-interval",
"type": "java.lang.Long", "type": "java.lang.Long",
"description": "Push metrics interval. unit: milliseconds default 30s.", "description": "Push metrics interval. unit: milliseconds default 60000ms.",
"sourceType": "com.tencent.cloud.rpc.enhancement.stat.config.PolarisStatProperties", "sourceType": "com.tencent.cloud.rpc.enhancement.stat.config.PolarisStatProperties",
"defaultValue": 30000 "defaultValue": 60000
}, },
{ {
"name": "spring.cloud.polaris.stat.pushgateway.open-gzip", "name": "spring.cloud.polaris.stat.pushgateway.open-gzip",

Loading…
Cancel
Save