Skip to content
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

Support ribbon service-level rule customization #478

Merged
merged 7 commits into from
Aug 3, 2022

Conversation

DerekYRC
Copy link
Contributor

@DerekYRC DerekYRC commented Aug 1, 2022

PR Type

Feature

Describe what this PR does for and how you did.

Support ribbon service-level rule customization

Adding the issue link (#xxx) if possible.

#445

Note

Checklist

  • Add copyright holder at the beginning of .class file if it is new.
  • Add information of this PR to CHANGELOG.md in root of project.
  • All junit tests passing.
  • Coverage from Codecov Report should not decrease.

Checklist (Optional)

  • Will Pull Request to branch of 2020.0 and 2021.0.
  • Add documentation in javadoc in code or comment below the PR if necessary.
  • Add your name as @author to the beginning of .class file.

@codecov-commenter
Copy link

codecov-commenter commented Aug 1, 2022

Codecov Report

Merging #478 (5fdf78a) into main (4ed19e2) will increase coverage by 0.27%.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##               main     #478      +/-   ##
============================================
+ Coverage     72.32%   72.59%   +0.27%     
- Complexity      876      886      +10     
============================================
  Files           172      173       +1     
  Lines          3306     3321      +15     
  Branches        413      414       +1     
============================================
+ Hits           2391     2411      +20     
+ Misses          701      693       -8     
- Partials        214      217       +3     
Impacted Files Coverage Δ
...laris/router/PolarisLoadBalancerCompositeRule.java 70.31% <100.00%> (+1.97%) ⬆️
...risLoadBalancerCompositeRuleBeanPostProcessor.java 100.00% <100.00%> (ø)
...oud/polaris/router/config/RibbonConfiguration.java 100.00% <100.00%> (+100.00%) ⬆️
...cent/cloud/polaris/context/ServiceRuleManager.java 38.46% <0.00%> (-5.13%) ⬇️
...om/tencent/cloud/common/util/BeanFactoryUtils.java 22.22% <0.00%> (+22.22%) ⬆️
...balancer/config/PolarisLoadBalancerProperties.java 69.23% <0.00%> (+23.07%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us.

lepdou
lepdou previously approved these changes Aug 2, 2022
Copy link
Contributor

@lepdou lepdou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

misselvexu
misselvexu previously approved these changes Aug 2, 2022
@SkyeBeFreeman SkyeBeFreeman merged commit a91a380 into Tencent:main Aug 3, 2022
@DerekYRC DerekYRC deleted the main-dev branch August 3, 2022 02:20
@SkyeBeFreeman
Copy link
Collaborator

@DerekYRC 刚刚测试发现代码实现有点问题,在com.tencent.cloud.polaris.router.beanprocessor.PolarisLoadBalancerCompositeRuleBeanPostProcessor#postProcessBeforeInitialization方法中,

List<RouterRequestInterceptor> requestInterceptors = BeanFactoryUtils.getBeans(beanFactory, RouterRequestInterceptor.class);

这一行没有正确获取到对应的RouterRequestInterceptor,导致路由相关标签无法注入到PolarisLoadBalancerCompositeRule中。

@DerekYRC
Copy link
Contributor Author

@DerekYRC 刚刚测试发现代码实现有点问题,在com.tencent.cloud.polaris.router.beanprocessor.PolarisLoadBalancerCompositeRuleBeanPostProcessor#postProcessBeforeInitialization方法中,

List<RouterRequestInterceptor> requestInterceptors = BeanFactoryUtils.getBeans(beanFactory, RouterRequestInterceptor.class);

这一行没有正确获取到对应的RouterRequestInterceptor,导致路由相关标签无法注入到PolarisLoadBalancerCompositeRule中。

我研究下

@DerekYRC
Copy link
Contributor Author

@DerekYRC 刚刚测试发现代码实现有点问题,在com.tencent.cloud.polaris.router.beanprocessor.PolarisLoadBalancerCompositeRuleBeanPostProcessor#postProcessBeforeInitialization方法中,

List<RouterRequestInterceptor> requestInterceptors = BeanFactoryUtils.getBeans(beanFactory, RouterRequestInterceptor.class);

这一行没有正确获取到对应的RouterRequestInterceptor,导致路由相关标签无法注入到PolarisLoadBalancerCompositeRule中。

@SkyeBeFreeman

问题出现在NamedContextFactory#createContext中创建的子容器没有继承父容器的bean,很奇怪子容器获取不到父容器的bean,有时间深究下,可能是框架的bug。

一种解决方法是PolarisLoadBalancerCompositeRuleBeanPostProcessor#postProcessBeforeInitialization方法中除IClientConfig外的所有bean都从父容器中获取。

今天修复下。

@SkyeBeFreeman
Copy link
Collaborator

@DerekYRC 刚刚测试发现代码实现有点问题,在com.tencent.cloud.polaris.router.beanprocessor.PolarisLoadBalancerCompositeRuleBeanPostProcessor#postProcessBeforeInitialization方法中,

List<RouterRequestInterceptor> requestInterceptors = BeanFactoryUtils.getBeans(beanFactory, RouterRequestInterceptor.class);

这一行没有正确获取到对应的RouterRequestInterceptor,导致路由相关标签无法注入到PolarisLoadBalancerCompositeRule中。

@SkyeBeFreeman

问题出现在NamedContextFactory#createContext中创建的子容器没有继承父容器的bean,很奇怪子容器获取不到父容器的bean,有时间深究下,可能是框架的bug。

一种解决方法是PolarisLoadBalancerCompositeRuleBeanPostProcessor#postProcessBeforeInitialization方法中除IClientConfig外的所有bean都从父容器中获取。

今天修复下。

是不是可以做个判断,如果子容器管理没有找到,就去父容器管理找找?

@DerekYRC
Copy link
Contributor Author

@SkyeBeFreeman 找到子容器获取不到父容器的bean的原因了,今晚再详细说明和修复下

@DerekYRC
Copy link
Contributor Author

@SkyeBeFreeman PR:#515

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants