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

[3.0] Optimize dubbo:monitor configuration #8477

Merged

Conversation

zhangyz-hd
Copy link
Contributor

@zhangyz-hd zhangyz-hd commented Aug 12, 2021

What is the purpose of the change

当用户需要自己扩展dubbo-monitor实现后,配置有问题

如配置<dubbo:monitor procotol="myMonitor"/>,monitorUrl=null
如配置<dubbo:monitor procotol="myMonitor" address="ip:port"/>,monitorUrl=dubbo://ip:port,变成了dubbo协议?!
如配置<dubbo:monitor address="myMonitor://ip:port"/>,monitorUrl=myMonitor://ip:port,当如果扩展不需要ip:port呢

Brief changelog

优化了org.apache.dubbo.config.utils.ConfigValidationUtils#loadMonitor,可支持如下配置方式

  • dubbo.monitor.protocol=registry
  • dubbo.monitor.protocol=service-discovery-registry
  • dubbo.monitor.protocol=user
  • dubbo.monitor.address=user://1.2.3.4:5678?k=v
  • dubbo.monitor.protocol=user + dubbo.monitor.address=1.2.3.4:5678

Checklist

  • Make sure there is a GitHub_issue field for the change (usually before you start working on it). Trivial changes like typos do not require a GitHub issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Check if is necessary to patch to Dubbo 3 if you are work on Dubbo 2.7
  • Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add sample in dubbo samples project.
  • Add some description to dubbo-website project if you are requesting to add a feature.
  • GitHub Actions works fine on your own branch.
  • If this contribution is large, please follow the Software Donation Guide.

@codecov-commenter
Copy link

codecov-commenter commented Aug 12, 2021

Codecov Report

Merging #8477 (623de6c) into 3.0 (961ce5f) will increase coverage by 0.08%.
The diff coverage is 81.25%.

Impacted file tree graph

@@             Coverage Diff              @@
##                3.0    #8477      +/-   ##
============================================
+ Coverage     62.83%   62.92%   +0.08%     
- Complexity      311      312       +1     
============================================
  Files          1112     1112              
  Lines         46633    46638       +5     
  Branches       7016     7019       +3     
============================================
+ Hits          29303    29347      +44     
+ Misses        14067    14034      -33     
+ Partials       3263     3257       -6     
Impacted Files Coverage Δ
...apache/dubbo/common/constants/CommonConstants.java 100.00% <ø> (ø)
...ache/dubbo/config/utils/ConfigValidationUtils.java 76.48% <81.25%> (+2.16%) ⬆️
.../apache/dubbo/remoting/transport/AbstractPeer.java 63.04% <0.00%> (-6.53%) ⬇️
...he/dubbo/remoting/transport/netty/NettyServer.java 70.17% <0.00%> (-3.51%) ⬇️
...pache/dubbo/registry/support/AbstractRegistry.java 76.64% <0.00%> (-1.46%) ⬇️
...pache/dubbo/remoting/transport/AbstractServer.java 61.42% <0.00%> (-1.43%) ⬇️
...he/dubbo/registry/multicast/MulticastRegistry.java 66.66% <0.00%> (-0.93%) ⬇️
...apache/dubbo/common/extension/ExtensionLoader.java 79.20% <0.00%> (+0.20%) ⬆️
...in/java/org/apache/dubbo/config/ServiceConfig.java 71.03% <0.00%> (+0.27%) ⬆️
.../dubbo/registry/integration/RegistryDirectory.java 48.83% <0.00%> (+0.33%) ⬆️
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 961ce5f...623de6c. Read the comment docs.

@zhangyz-hd zhangyz-hd changed the title [3.0] Optimize dubbo:monitor configuration [WIP] Optimize dubbo:monitor configuration Aug 12, 2021
@zhangyz-hd zhangyz-hd changed the title [WIP] Optimize dubbo:monitor configuration [3.0] Optimize dubbo:monitor configuration Aug 12, 2021
@zhangyz-hd zhangyz-hd changed the title [3.0] Optimize dubbo:monitor configuration [WIP] Optimize dubbo:monitor configuration Aug 12, 2021
@zhangyz-hd zhangyz-hd changed the title [WIP] Optimize dubbo:monitor configuration [3.0] Optimize dubbo:monitor configuration Aug 12, 2021
@AlbumenJ AlbumenJ merged commit b48a7c9 into apache:3.0 Aug 15, 2021
@AlbumenJ AlbumenJ added this to the 3.0.3 milestone Aug 15, 2021
} else if (monitor != null) {
address = monitor.getAddress();
}
if (ConfigUtils.isNotEmpty(address)) {
String protocol = monitor == null ? DUBBO_PROTOCOL : monitor.getProtocol();
Copy link
Contributor

Choose a reason for hiding this comment

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

Set protocol to DUBBO here will cause loading default dubbo monitor when the application didnot have any monitor config.

Copy link
Contributor

Choose a reason for hiding this comment

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

null should be returned in this scene

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I'll fix it.

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.

4 participants