-
Notifications
You must be signed in to change notification settings - Fork 975
optimize config #3034
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
base: develop
Are you sure you want to change the base?
optimize config #3034
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #3034 +/- ##
===========================================
- Coverage 46.76% 40.25% -6.51%
===========================================
Files 295 457 +162
Lines 17172 32552 +15380
===========================================
+ Hits 8031 13105 +5074
- Misses 8287 18184 +9897
- Partials 854 1263 +409 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR optimizes the config.GetConsumerServiceByInterfaceName method by introducing a new mechanism to retrieve consumer services from URL attributes instead of relying solely on the legacy interface name lookup. The changes provide a fallback mechanism where services can be obtained directly from the URL's RpcServiceKey attribute when available.
- Adds fallback logic to check for
RpcServiceKeyattribute before using interface name lookup - Updates dependency management by moving
github.com/spf13/viperfrom indirect to direct dependency - Refactors test cases to use a mock service instead of the original
HelloService
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| protocol/triple/dubbo3_invoker.go | Adds fallback to retrieve consumer service from URL attribute |
| protocol/grpc/client.go | Adds same fallback mechanism for GRPC client initialization |
| go.mod | Moves viper dependency from indirect to direct |
| config/service_test.go | Updates tests to use MockHelloService instead of HelloService |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
WIP |
|
PTAL |
| // TODO: After the config is removed, remove the test | ||
| func InitDubboServer() { | ||
| serviceConfig := config.NewServiceConfigBuilder(). | ||
| SetInterface("org.apache.dubbo.DubboGreeterImpl"). | ||
| SetProtocolIDs("tripleKey").Build() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls add corresponding test in new api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls add corresponding test in new api
dubbo3只有config api方式,现在用new triple代替了。加了TODO后续移除
|
resolve the conflicts |
refactor: update getty configuration for new api
|
现在好像是由于冲突问题ci没运行,先解决一下冲突问题,看一下ci结果 |
# Conflicts: # server/server.go
已处理 |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm



#2741
optimization points
1. optimize server.go
the content of the global variable config/service.go was migrated to the server/server.go struct for internal use.
2. optimize server.go params
optimize the Server struct member variable svcOptsMap in server/server.go: change key: *ServiceOptions, value: *common.ServiceInfo to key: service name, value: *ServiceOptions, and add an additional map member variable to store key: interfaceName, value: *ServiceOptions.
old:

new:

3. dealing with the unreasonable issue of exportServices
In the old code, compatibility issues with Java-Dubbo regarding the case sensitivity of the first letter were handled in the exportServices method within server/server.go. This approach was not very reasonable and has now been migrated to Register for compatibility.
old:

new:

4. optimize Register and RegisterService method
old:

new:

5. optimize export
old:

new:

6. add protocols config compatibility
7. optimize grpc config compatibility
8. optimize Getty config compatibility(by xuetao)