File tree Expand file tree Collapse file tree 3 files changed +8
-6
lines changed
sermant-plugins/sermant-flowcontrol/flowcontrol-plugin/src/main/java/io/sermant/flowcontrol Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -245,10 +245,10 @@ protected Optional<ServiceInstance> chooseServiceInstanceForXds() {
245
245
if (CollectionUtils .isEmpty (serviceInstanceSet )) {
246
246
return Optional .empty ();
247
247
}
248
+ removeCircuitBreakerInstance (scenarioInfo , serviceInstanceSet );
248
249
if (RetryContext .INSTANCE .isPolicyNeedRetry ()) {
249
250
removeRetriedServiceInstance (serviceInstanceSet );
250
251
}
251
- removeCircuitBreakerInstance (scenarioInfo , serviceInstanceSet );
252
252
return Optional .ofNullable (chooseServiceInstanceByLoadBalancer (serviceInstanceSet , scenarioInfo ));
253
253
}
254
254
@@ -271,7 +271,9 @@ private ServiceInstance chooseServiceInstanceByLoadBalancer(Set<ServiceInstance>
271
271
FlowControlScenario scenarioInfo ) {
272
272
XdsLoadBalancer loadBalancer = XdsLoadBalancerFactory .getLoadBalancer (scenarioInfo .getServiceName (),
273
273
scenarioInfo .getClusterName ());
274
- return loadBalancer .selectInstance (new ArrayList <>(instanceSet ));
274
+ ServiceInstance serviceInstance = loadBalancer .selectInstance (new ArrayList <>(instanceSet ));
275
+ RetryContext .INSTANCE .updateRetriedServiceInstance (serviceInstance );
276
+ return serviceInstance ;
275
277
}
276
278
277
279
private void removeCircuitBreakerInstance (FlowControlScenario scenarioInfo , Set <ServiceInstance > instanceSet ) {
Original file line number Diff line number Diff line change 16
16
17
17
package io .sermant .flowcontrol .retry .client ;
18
18
19
- import io .sermant .core .plugin .agent .declarer .AbstractPluginDeclarer ;
20
19
import io .sermant .core .plugin .agent .declarer .InterceptDeclarer ;
21
20
import io .sermant .core .plugin .agent .matcher .ClassMatcher ;
22
21
import io .sermant .core .plugin .agent .matcher .MethodMatcher ;
22
+ import io .sermant .flowcontrol .AbstractXdsDeclarer ;
23
23
24
24
/**
25
25
* For OKHTTP requests, obtain the instance list from the registry to block them
26
26
*
27
27
* @author zhp
28
28
* @since 2024-12-20
29
29
*/
30
- public class OkHttp3ClientDeclarer extends AbstractPluginDeclarer {
30
+ public class OkHttp3ClientDeclarer extends AbstractXdsDeclarer {
31
31
/**
32
32
* The fully qualified name of the enhanced okhttp request
33
33
*/
Original file line number Diff line number Diff line change 16
16
17
17
package io .sermant .flowcontrol .retry .client ;
18
18
19
- import io .sermant .core .plugin .agent .declarer .AbstractPluginDeclarer ;
20
19
import io .sermant .core .plugin .agent .declarer .InterceptDeclarer ;
21
20
import io .sermant .core .plugin .agent .matcher .ClassMatcher ;
22
21
import io .sermant .core .plugin .agent .matcher .MethodMatcher ;
22
+ import io .sermant .flowcontrol .AbstractXdsDeclarer ;
23
23
24
24
/**
25
25
* For OKHTTP requests, modify the URL of request
26
26
*
27
27
* @author zhp
28
28
* @since 2024-12-20
29
29
*/
30
- public class OkHttpClientInterceptorChainDeclarer extends AbstractPluginDeclarer {
30
+ public class OkHttpClientInterceptorChainDeclarer extends AbstractXdsDeclarer {
31
31
private static final String ENHANCE_CLASSES =
32
32
"com.squareup.okhttp.Call$ApplicationInterceptorChain" ;
33
33
You can’t perform that action at this time.
0 commit comments