Skip to content

feat:support circuit breaker metrics reporting. #1573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/1566)
- [feat:support polaris event.](https://github.com/Tencent/spring-cloud-tencent/pull/1571)
- [feat:support circuit breaker metrics reporting.](https://github.com/Tencent/spring-cloud-tencent/pull/1572)
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public <T> T run(Supplier<T> toRun, Function<Throwable, T> fallback) {
}
catch (CallAbortedException e) {
LOGGER.debug("PolarisCircuitBreaker CallAbortedException: {}", e.getMessage());
PolarisCircuitBreakerUtils.reportStatus(consumerAPI, conf, e);
reportStatus(e);
return fallback.apply(e);
}
catch (Exception e) {
Expand All @@ -97,4 +97,8 @@ public void onSuccess(InvokeContext.ResponseContext responseContext) {
public void onError(InvokeContext.ResponseContext responseContext) {
invokeHandler.onError(responseContext);
}

public void reportStatus(CallAbortedException e) {
PolarisCircuitBreakerUtils.reportStatus(consumerAPI, conf, e);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public void run(EnhancedPluginContext context) throws Throwable {
}
catch (CallAbortedException e) {
LOG.debug("[CircuitBreakerPlugin] request is aborted. request service url=[{}]", request.getServiceUrl());
polarisCircuitBreaker.reportStatus(e);
if (e.getFallbackInfo() != null) {
Object fallbackResponse = new PolarisCircuitBreakerHttpResponse(e.getFallbackInfo());
putMetadataObjectValue(ContextConstant.CircuitBreaker.CIRCUIT_BREAKER_FALLBACK_HTTP_RESPONSE, fallbackResponse);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ public class PolarisStatProperties {

/**
* Push metrics interval.
* unit: milliseconds default 30s.
* unit: milliseconds default 60s.
*/
@Value("${spring.cloud.polaris.stat.pushgateway.push-interval:#{30000}}")
private Long pushGatewayPushInterval = 30 * 1000L;
@Value("${spring.cloud.polaris.stat.pushgateway.push-interval:#{60000}}")
private Long pushGatewayPushInterval = 60 * 1000L;

/**
* If push gateway gzip open. default false.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@
{
"name": "spring.cloud.polaris.stat.pushgateway.push-interval",
"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",
"defaultValue": 30000
"defaultValue": 60000
},
{
"name": "spring.cloud.polaris.stat.pushgateway.open-gzip",
Expand Down
Loading