Skip to content

feat:support circuit breaker metrics reporting. #1544

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 12, 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 @@ -27,4 +27,5 @@
- [feat:support auth.](https://github.com/Tencent/spring-cloud-tencent/pull/1541)
- [feat:support smooth upgrade from tsf. ](https://github.com/Tencent/spring-cloud-tencent/pull/1542)
- [feat:support polaris event.](https://github.com/Tencent/spring-cloud-tencent/pull/1543)
- [feat:support circuit breaker metrics reporting.](https://github.com/Tencent/spring-cloud-tencent/pull/1544)

Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,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,11 +97,7 @@ public void onError(InvokeContext.ResponseContext responseContext) {
invokeHandler.onError(responseContext);
}

public PolarisCircuitBreakerConfigBuilder.PolarisCircuitBreakerConfiguration getConf() {
return conf;
}

public ConsumerAPI getConsumerAPI() {
return consumerAPI;
public void reportStatus(CallAbortedException e) {
PolarisCircuitBreakerUtils.reportStatus(consumerAPI, conf, e);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,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