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() {
245245        if  (CollectionUtils .isEmpty (serviceInstanceSet )) {
246246            return  Optional .empty ();
247247        }
248+         removeCircuitBreakerInstance (scenarioInfo , serviceInstanceSet );
248249        if  (RetryContext .INSTANCE .isPolicyNeedRetry ()) {
249250            removeRetriedServiceInstance (serviceInstanceSet );
250251        }
251-         removeCircuitBreakerInstance (scenarioInfo , serviceInstanceSet );
252252        return  Optional .ofNullable (chooseServiceInstanceByLoadBalancer (serviceInstanceSet , scenarioInfo ));
253253    }
254254
@@ -271,7 +271,9 @@ private ServiceInstance chooseServiceInstanceByLoadBalancer(Set<ServiceInstance>
271271            FlowControlScenario  scenarioInfo ) {
272272        XdsLoadBalancer  loadBalancer  = XdsLoadBalancerFactory .getLoadBalancer (scenarioInfo .getServiceName (),
273273                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 ;
275277    }
276278
277279    private  void  removeCircuitBreakerInstance (FlowControlScenario  scenarioInfo , Set <ServiceInstance > instanceSet ) {
Original file line number Diff line number Diff line change 1616
1717package  io .sermant .flowcontrol .retry .client ;
1818
19- import  io .sermant .core .plugin .agent .declarer .AbstractPluginDeclarer ;
2019import  io .sermant .core .plugin .agent .declarer .InterceptDeclarer ;
2120import  io .sermant .core .plugin .agent .matcher .ClassMatcher ;
2221import  io .sermant .core .plugin .agent .matcher .MethodMatcher ;
22+ import  io .sermant .flowcontrol .AbstractXdsDeclarer ;
2323
2424/** 
2525 * For OKHTTP requests, obtain the instance list from the registry to block them 
2626 * 
2727 * @author zhp 
2828 * @since 2024-12-20 
2929 */ 
30- public  class  OkHttp3ClientDeclarer  extends  AbstractPluginDeclarer  {
30+ public  class  OkHttp3ClientDeclarer  extends  AbstractXdsDeclarer  {
3131    /** 
3232     * The fully qualified name of the enhanced okhttp request 
3333     */ 
Original file line number Diff line number Diff line change 1616
1717package  io .sermant .flowcontrol .retry .client ;
1818
19- import  io .sermant .core .plugin .agent .declarer .AbstractPluginDeclarer ;
2019import  io .sermant .core .plugin .agent .declarer .InterceptDeclarer ;
2120import  io .sermant .core .plugin .agent .matcher .ClassMatcher ;
2221import  io .sermant .core .plugin .agent .matcher .MethodMatcher ;
22+ import  io .sermant .flowcontrol .AbstractXdsDeclarer ;
2323
2424/** 
2525 * For OKHTTP requests, modify the URL of request 
2626 * 
2727 * @author zhp 
2828 * @since 2024-12-20 
2929 */ 
30- public  class  OkHttpClientInterceptorChainDeclarer  extends  AbstractPluginDeclarer  {
30+ public  class  OkHttpClientInterceptorChainDeclarer  extends  AbstractXdsDeclarer  {
3131    private  static  final  String  ENHANCE_CLASSES  =
3232            "com.squareup.okhttp.Call$ApplicationInterceptorChain" ;
3333
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments