You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "nanjiek (via GitHub)" <gi...@apache.org> on 2025/07/06 08:46:55 UTC
[PR] feat: replace application use of config package to global package in directory of registry [dubbo-go]
nanjiek opened a new pull request, #2942:
URL: https://github.com/apache/dubbo-go/pull/2942
application in directory of registry previous depends on config package, this pr replace it with global package. The changes primarily focus on replacing the usage of config.GetRootConfig().Application with ApplicationConfRaw.(*global.ApplicationConfig),
removing redundant compatibility processing minor improvements to comments and code clarity are included.
In directory still remains the use config package. This is just for the compatible with the use of old config. Cause if we remove it, this filter won't be registered if users use config.GetRootConfig().Applicationto start service.
But remove the config from directory to tell the user how to import applicationConfig correctly to register now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: replace application use of config package to global package in directory of registry [dubbo-go]
Posted by "1kasa (via GitHub)" <gi...@apache.org>.
1kasa commented on code in PR #2942:
URL: https://github.com/apache/dubbo-go/pull/2942#discussion_r2203219691
##########
registry/directory/directory.go:
##########
@@ -575,14 +576,27 @@ type consumerConfigurationListener struct {
directory *RegistryDirectory
}
-func newConsumerConfigurationListener(dir *RegistryDirectory) *consumerConfigurationListener {
+func newConsumerConfigurationListener(dir *RegistryDirectory, url *common.URL) *consumerConfigurationListener {
listener := &consumerConfigurationListener{directory: dir}
+
+ // TODO: Temporary compatibility with old APIs, can be removed later
application := config.GetRootConfig().Application
listener.InitWith(
application.Name+constant.ConfiguratorSuffix,
listener,
extension.GetDefaultConfiguratorFunc(),
)
+
+ if ApplicationConfRaw, ok := url.GetAttribute(constant.ApplicationKey); ok {
Review Comment:
The current method of obtaining the same as above is invalid because the Attribute field of the URL has not been set
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: replace application use of config package to global package in directory of registry [dubbo-go]
Posted by "nanjiek (via GitHub)" <gi...@apache.org>.
nanjiek commented on code in PR #2942:
URL: https://github.com/apache/dubbo-go/pull/2942#discussion_r2249948153
##########
registry/directory/directory.go:
##########
@@ -575,14 +576,27 @@ type consumerConfigurationListener struct {
directory *RegistryDirectory
}
-func newConsumerConfigurationListener(dir *RegistryDirectory) *consumerConfigurationListener {
+func newConsumerConfigurationListener(dir *RegistryDirectory, url *common.URL) *consumerConfigurationListener {
listener := &consumerConfigurationListener{directory: dir}
+
+ // TODO: Temporary compatibility with old APIs, can be removed later
application := config.GetRootConfig().Application
listener.InitWith(
application.Name+constant.ConfiguratorSuffix,
listener,
extension.GetDefaultConfiguratorFunc(),
)
+
+ if ApplicationConfRaw, ok := url.GetAttribute(constant.ApplicationKey); ok {
Review Comment:
I set the Attribute in the directory_test. What's more, if the application config doesn't exsit in the url, the code will use the DefaultApplicationConfig of global.
```
applicationConfig := &global.ApplicationConfig{
Name: "test-application",
}
url, _ := common.NewURL("mock://127.0.0.1:1111",
common.WithAttribute(constant.ApplicationKey, applicationConfig),
)
```
```
func NewRegistryDirectory(url *common.URL, registry registry.Registry) (directory.Directory, error) {
if url.SubURL == nil {
return nil, perrors.Errorf("url is invalid, suburl can not be nil")
}
logger.Debugf("new RegistryDirectory for service :%s.", url.Key())
if _, ok := url.GetAttribute(constant.ApplicationKey); !ok {
application := config.GetRootConfig().Application
if application == nil {
defaultAppConfig := global.DefaultApplicationConfig()
url.SetAttribute(constant.ApplicationKey, defaultAppConfig)
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: replace application use of config package to global package in directory of registry [dubbo-go]
Posted by "nanjiek (via GitHub)" <gi...@apache.org>.
nanjiek commented on code in PR #2942:
URL: https://github.com/apache/dubbo-go/pull/2942#discussion_r2249948153
##########
registry/directory/directory.go:
##########
@@ -575,14 +576,27 @@ type consumerConfigurationListener struct {
directory *RegistryDirectory
}
-func newConsumerConfigurationListener(dir *RegistryDirectory) *consumerConfigurationListener {
+func newConsumerConfigurationListener(dir *RegistryDirectory, url *common.URL) *consumerConfigurationListener {
listener := &consumerConfigurationListener{directory: dir}
+
+ // TODO: Temporary compatibility with old APIs, can be removed later
application := config.GetRootConfig().Application
listener.InitWith(
application.Name+constant.ConfiguratorSuffix,
listener,
extension.GetDefaultConfiguratorFunc(),
)
+
+ if ApplicationConfRaw, ok := url.GetAttribute(constant.ApplicationKey); ok {
Review Comment:
I set the Attribute in the directory_test. What's more, if the application config doesn't exsit in the url, the code will use the DefaultApplicationConfig of global.
’
applicationConfig := &global.ApplicationConfig{
Name: "test-application",
}
url, _ := common.NewURL("mock://127.0.0.1:1111",
common.WithAttribute(constant.ApplicationKey, applicationConfig),
)
‘
`
func NewRegistryDirectory(url *common.URL, registry registry.Registry) (directory.Directory, error) {
if url.SubURL == nil {
return nil, perrors.Errorf("url is invalid, suburl can not be nil")
}
logger.Debugf("new RegistryDirectory for service :%s.", url.Key())
if _, ok := url.GetAttribute(constant.ApplicationKey); !ok {
application := config.GetRootConfig().Application
if application == nil {
defaultAppConfig := global.DefaultApplicationConfig()
url.SetAttribute(constant.ApplicationKey, defaultAppConfig)
}
}
`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: replace application use of config package to global package in directory of registry [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #2942:
URL: https://github.com/apache/dubbo-go/pull/2942#issuecomment-3148422511
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=2942) **Quality Gate passed**
Issues
 [1 New issue](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2942&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2942&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2942&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2942&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2942&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=2942)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: replace application use of config package to global package in directory of registry [dubbo-go]
Posted by "nanjiek (via GitHub)" <gi...@apache.org>.
nanjiek commented on code in PR #2942:
URL: https://github.com/apache/dubbo-go/pull/2942#discussion_r2249948153
##########
registry/directory/directory.go:
##########
@@ -575,14 +576,27 @@ type consumerConfigurationListener struct {
directory *RegistryDirectory
}
-func newConsumerConfigurationListener(dir *RegistryDirectory) *consumerConfigurationListener {
+func newConsumerConfigurationListener(dir *RegistryDirectory, url *common.URL) *consumerConfigurationListener {
listener := &consumerConfigurationListener{directory: dir}
+
+ // TODO: Temporary compatibility with old APIs, can be removed later
application := config.GetRootConfig().Application
listener.InitWith(
application.Name+constant.ConfiguratorSuffix,
listener,
extension.GetDefaultConfiguratorFunc(),
)
+
+ if ApplicationConfRaw, ok := url.GetAttribute(constant.ApplicationKey); ok {
Review Comment:
I set the Attribute in the directory_test. What's more, if the application config doesn't exsit in the url, the code will use the DefaultApplicationConfig of global.
applicationConfig := &global.ApplicationConfig{
Name: "test-application",
}
url, _ := common.NewURL("mock://127.0.0.1:1111",
common.WithAttribute(constant.ApplicationKey, applicationConfig),
)
![Uploading 屏幕截图 2025-08-03 200835.png…]()
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: replace application use of config package to global package in directory of registry [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #2942:
URL: https://github.com/apache/dubbo-go/pull/2942#issuecomment-3124399438
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=2942) **Quality Gate passed**
Issues
 [1 New issue](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2942&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2942&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2942&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2942&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2942&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=2942)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: replace application use of config package to global package in directory of registry [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #2942:
URL: https://github.com/apache/dubbo-go/pull/2942#issuecomment-3041307453
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=2942) **Quality Gate passed**
Issues
 [1 New issue](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2942&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2942&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2942&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2942&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2942&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=2942)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: replace application use of config package to global package in directory of registry [dubbo-go]
Posted by "nanjiek (via GitHub)" <gi...@apache.org>.
nanjiek commented on code in PR #2942:
URL: https://github.com/apache/dubbo-go/pull/2942#discussion_r2249948153
##########
registry/directory/directory.go:
##########
@@ -575,14 +576,27 @@ type consumerConfigurationListener struct {
directory *RegistryDirectory
}
-func newConsumerConfigurationListener(dir *RegistryDirectory) *consumerConfigurationListener {
+func newConsumerConfigurationListener(dir *RegistryDirectory, url *common.URL) *consumerConfigurationListener {
listener := &consumerConfigurationListener{directory: dir}
+
+ // TODO: Temporary compatibility with old APIs, can be removed later
application := config.GetRootConfig().Application
listener.InitWith(
application.Name+constant.ConfiguratorSuffix,
listener,
extension.GetDefaultConfiguratorFunc(),
)
+
+ if ApplicationConfRaw, ok := url.GetAttribute(constant.ApplicationKey); ok {
Review Comment:
I set the Attribute in the directory_test. What's more, if the application config doesn't exsit in the url, the code will use the DefaultApplicationConfig of global.
applicationConfig := &global.ApplicationConfig{
Name: "test-application",
}
url, _ := common.NewURL("mock://127.0.0.1:1111",
common.WithAttribute(constant.ApplicationKey, applicationConfig),
)
if _, ok := url.GetAttribute(constant.ApplicationKey); !ok {
application := config.GetRootConfig().Application
if application == nil {
defaultAppConfig := global.DefaultApplicationConfig()
url.SetAttribute(constant.ApplicationKey, defaultAppConfig)
}
}
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: replace application use of config package to global package in directory of registry [dubbo-go]
Posted by "nanjiek (via GitHub)" <gi...@apache.org>.
nanjiek commented on code in PR #2942:
URL: https://github.com/apache/dubbo-go/pull/2942#discussion_r2249948153
##########
registry/directory/directory.go:
##########
@@ -575,14 +576,27 @@ type consumerConfigurationListener struct {
directory *RegistryDirectory
}
-func newConsumerConfigurationListener(dir *RegistryDirectory) *consumerConfigurationListener {
+func newConsumerConfigurationListener(dir *RegistryDirectory, url *common.URL) *consumerConfigurationListener {
listener := &consumerConfigurationListener{directory: dir}
+
+ // TODO: Temporary compatibility with old APIs, can be removed later
application := config.GetRootConfig().Application
listener.InitWith(
application.Name+constant.ConfiguratorSuffix,
listener,
extension.GetDefaultConfiguratorFunc(),
)
+
+ if ApplicationConfRaw, ok := url.GetAttribute(constant.ApplicationKey); ok {
Review Comment:
I set the Attribute in the directory_test. What's more, if the application config doesn't exsit in the url, the code will use the DefaultApplicationConfig of global.
```
applicationConfig := &global.ApplicationConfig{
Name: "test-application",
}
url, _ := common.NewURL("mock://127.0.0.1:1111",
common.WithAttribute(constant.ApplicationKey, applicationConfig),
)
```
```
func NewRegistryDirectory(url *common.URL, registry registry.Registry) (directory.Directory, error) {
if url.SubURL == nil {
return nil, perrors.Errorf("url is invalid, suburl can not be nil")
}
logger.Debugf("new RegistryDirectory for service :%s.", url.Key())
if _, ok := url.GetAttribute(constant.ApplicationKey); !ok {
application := config.GetRootConfig().Application
if application == nil {
defaultAppConfig := global.DefaultApplicationConfig()
url.SetAttribute(constant.ApplicationKey, defaultAppConfig)
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: replace application use of config package to global package in directory of registry [dubbo-go]
Posted by "AlexStocks (via GitHub)" <gi...@apache.org>.
AlexStocks merged PR #2942:
URL: https://github.com/apache/dubbo-go/pull/2942
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: replace application use of config package to global package in directory of registry [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #2942:
URL: https://github.com/apache/dubbo-go/pull/2942#issuecomment-3041294755
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=2942) **Quality Gate passed**
Issues
 [1 New issue](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2942&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2942&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2942&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2942&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2942&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=2942)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: replace application use of config package to global package in directory of registry [dubbo-go]
Posted by "nanjiek (via GitHub)" <gi...@apache.org>.
nanjiek commented on code in PR #2942:
URL: https://github.com/apache/dubbo-go/pull/2942#discussion_r2249948153
##########
registry/directory/directory.go:
##########
@@ -575,14 +576,27 @@ type consumerConfigurationListener struct {
directory *RegistryDirectory
}
-func newConsumerConfigurationListener(dir *RegistryDirectory) *consumerConfigurationListener {
+func newConsumerConfigurationListener(dir *RegistryDirectory, url *common.URL) *consumerConfigurationListener {
listener := &consumerConfigurationListener{directory: dir}
+
+ // TODO: Temporary compatibility with old APIs, can be removed later
application := config.GetRootConfig().Application
listener.InitWith(
application.Name+constant.ConfiguratorSuffix,
listener,
extension.GetDefaultConfiguratorFunc(),
)
+
+ if ApplicationConfRaw, ok := url.GetAttribute(constant.ApplicationKey); ok {
Review Comment:
I set the Attribute in the directory_test. What's more, if the application config doesn't exsit in the url, the code will use the DefaultApplicationConfig of global.
` applicationConfig := &global.ApplicationConfig{
Name: "test-application",
}
url, _ := common.NewURL("mock://127.0.0.1:1111",
common.WithAttribute(constant.ApplicationKey, applicationConfig),
)`
`if _, ok := url.GetAttribute(constant.ApplicationKey); !ok {
application := config.GetRootConfig().Application
if application == nil {
defaultAppConfig := global.DefaultApplicationConfig()
url.SetAttribute(constant.ApplicationKey, defaultAppConfig)
}
}
`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: replace application use of config package to global package in directory of registry [dubbo-go]
Posted by "nanjiek (via GitHub)" <gi...@apache.org>.
nanjiek commented on code in PR #2942:
URL: https://github.com/apache/dubbo-go/pull/2942#discussion_r2249948153
##########
registry/directory/directory.go:
##########
@@ -575,14 +576,27 @@ type consumerConfigurationListener struct {
directory *RegistryDirectory
}
-func newConsumerConfigurationListener(dir *RegistryDirectory) *consumerConfigurationListener {
+func newConsumerConfigurationListener(dir *RegistryDirectory, url *common.URL) *consumerConfigurationListener {
listener := &consumerConfigurationListener{directory: dir}
+
+ // TODO: Temporary compatibility with old APIs, can be removed later
application := config.GetRootConfig().Application
listener.InitWith(
application.Name+constant.ConfiguratorSuffix,
listener,
extension.GetDefaultConfiguratorFunc(),
)
+
+ if ApplicationConfRaw, ok := url.GetAttribute(constant.ApplicationKey); ok {
Review Comment:
I set the Attribute in the directory_test. What's more, if the application config doesn't exsit in the url, the code will use the DefaultApplicationConfig of global.
applicationConfig := &global.ApplicationConfig{
Name: "test-application",
}
url, _ := common.NewURL("mock://127.0.0.1:1111",
common.WithAttribute(constant.ApplicationKey, applicationConfig),
)
if _, ok := url.GetAttribute(constant.ApplicationKey); !ok {
application := config.GetRootConfig().Application
if application == nil {
defaultAppConfig := global.DefaultApplicationConfig()
url.SetAttribute(constant.ApplicationKey, defaultAppConfig)
}
}
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: replace application use of config package to global package in directory of registry [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #2942:
URL: https://github.com/apache/dubbo-go/pull/2942#issuecomment-3148412613
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=2942) **Quality Gate passed**
Issues
 [1 New issue](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2942&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2942&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2942&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2942&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2942&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=2942)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: replace application use of config package to global package in directory of registry [dubbo-go]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #2942:
URL: https://github.com/apache/dubbo-go/pull/2942#discussion_r2188834892
##########
registry/directory/directory.go:
##########
@@ -575,14 +576,27 @@ type consumerConfigurationListener struct {
directory *RegistryDirectory
}
-func newConsumerConfigurationListener(dir *RegistryDirectory) *consumerConfigurationListener {
+func newConsumerConfigurationListener(dir *RegistryDirectory, url *common.URL) *consumerConfigurationListener {
listener := &consumerConfigurationListener{directory: dir}
+
+ // TODO: Temporary compatibility with old APIs, can be removed later
application := config.GetRootConfig().Application
listener.InitWith(
application.Name+constant.ConfiguratorSuffix,
listener,
extension.GetDefaultConfiguratorFunc(),
)
+
+ if ApplicationConfRaw, ok := url.GetAttribute(constant.ApplicationKey); ok {
Review Comment:
url.GetAttribute retrieves URL attributes, not params; since ApplicationKey is set via WithParamsValue, this branch will never execute. Consider using url.GetParam or url.SubURL.GetParam to fetch the ApplicationKey parameter.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: replace application use of config package to global package in directory of registry [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #2942:
URL: https://github.com/apache/dubbo-go/pull/2942#issuecomment-3041213290
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=2942) **Quality Gate passed**
Issues
 [1 New issue](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2942&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2942&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2942&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2942&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2942&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=2942)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: replace application use of config package to global package in directory of registry [dubbo-go]
Posted by "nanjiek (via GitHub)" <gi...@apache.org>.
nanjiek commented on code in PR #2942:
URL: https://github.com/apache/dubbo-go/pull/2942#discussion_r2249951010
##########
registry/directory/directory.go:
##########
@@ -575,14 +576,27 @@ type consumerConfigurationListener struct {
directory *RegistryDirectory
}
-func newConsumerConfigurationListener(dir *RegistryDirectory) *consumerConfigurationListener {
+func newConsumerConfigurationListener(dir *RegistryDirectory, url *common.URL) *consumerConfigurationListener {
listener := &consumerConfigurationListener{directory: dir}
+
+ // TODO: Temporary compatibility with old APIs, can be removed later
application := config.GetRootConfig().Application
listener.InitWith(
application.Name+constant.ConfiguratorSuffix,
listener,
extension.GetDefaultConfiguratorFunc(),
)
+
+ if ApplicationConfRaw, ok := url.GetAttribute(constant.ApplicationKey); ok {
Review Comment:
I demonstrated the way to initialize applicationconfig in directory_test. If the user does not set the attributes related to applicationconfig in the url, The default applicationconfig in global will be used.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: replace application use of config package to global package in directory of registry [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #2942:
URL: https://github.com/apache/dubbo-go/pull/2942#issuecomment-3124382436
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=2942) **Quality Gate passed**
Issues
 [1 New issue](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2942&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2942&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2942&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2942&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2942&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=2942)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: replace application use of config package to global package in directory of registry [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #2942:
URL: https://github.com/apache/dubbo-go/pull/2942#issuecomment-3124466121
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=2942) **Quality Gate passed**
Issues
 [1 New issue](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2942&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2942&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2942&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2942&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2942&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=2942)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: replace application use of config package to global package in directory of registry [dubbo-go]
Posted by "nanjiek (via GitHub)" <gi...@apache.org>.
nanjiek commented on code in PR #2942:
URL: https://github.com/apache/dubbo-go/pull/2942#discussion_r2249948153
##########
registry/directory/directory.go:
##########
@@ -575,14 +576,27 @@ type consumerConfigurationListener struct {
directory *RegistryDirectory
}
-func newConsumerConfigurationListener(dir *RegistryDirectory) *consumerConfigurationListener {
+func newConsumerConfigurationListener(dir *RegistryDirectory, url *common.URL) *consumerConfigurationListener {
listener := &consumerConfigurationListener{directory: dir}
+
+ // TODO: Temporary compatibility with old APIs, can be removed later
application := config.GetRootConfig().Application
listener.InitWith(
application.Name+constant.ConfiguratorSuffix,
listener,
extension.GetDefaultConfiguratorFunc(),
)
+
+ if ApplicationConfRaw, ok := url.GetAttribute(constant.ApplicationKey); ok {
Review Comment:
I set the Attribute in the directory_test. What's more, if the application config doesn't exsit in the url, the code will use the DefaultApplicationConfig of global.
``` applicationConfig := &global.ApplicationConfig{
Name: "test-application",
}
url, _ := common.NewURL("mock://127.0.0.1:1111",
common.WithAttribute(constant.ApplicationKey, applicationConfig),
)
```
```
func NewRegistryDirectory(url *common.URL, registry registry.Registry) (directory.Directory, error) {
if url.SubURL == nil {
return nil, perrors.Errorf("url is invalid, suburl can not be nil")
}
logger.Debugf("new RegistryDirectory for service :%s.", url.Key())
if _, ok := url.GetAttribute(constant.ApplicationKey); !ok {
application := config.GetRootConfig().Application
if application == nil {
defaultAppConfig := global.DefaultApplicationConfig()
url.SetAttribute(constant.ApplicationKey, defaultAppConfig)
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: replace application use of config package to global package in directory of registry [dubbo-go]
Posted by "nanjiek (via GitHub)" <gi...@apache.org>.
nanjiek commented on code in PR #2942:
URL: https://github.com/apache/dubbo-go/pull/2942#discussion_r2249948153
##########
registry/directory/directory.go:
##########
@@ -575,14 +576,27 @@ type consumerConfigurationListener struct {
directory *RegistryDirectory
}
-func newConsumerConfigurationListener(dir *RegistryDirectory) *consumerConfigurationListener {
+func newConsumerConfigurationListener(dir *RegistryDirectory, url *common.URL) *consumerConfigurationListener {
listener := &consumerConfigurationListener{directory: dir}
+
+ // TODO: Temporary compatibility with old APIs, can be removed later
application := config.GetRootConfig().Application
listener.InitWith(
application.Name+constant.ConfiguratorSuffix,
listener,
extension.GetDefaultConfiguratorFunc(),
)
+
+ if ApplicationConfRaw, ok := url.GetAttribute(constant.ApplicationKey); ok {
Review Comment:
I set the Attribute in the directory_test. What's more, if the application config doesn't exsit in the url, the code will use the DefaultApplicationConfig of global.
applicationConfig := &global.ApplicationConfig{
Name: "test-application",
}
url, _ := common.NewURL("mock://127.0.0.1:1111",
common.WithAttribute(constant.ApplicationKey, applicationConfig),
)
![Uploading image.png…]()
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: replace application use of config package to global package in directory of registry [dubbo-go]
Posted by "1kasa (via GitHub)" <gi...@apache.org>.
1kasa commented on code in PR #2942:
URL: https://github.com/apache/dubbo-go/pull/2942#discussion_r2255913274
##########
registry/directory/directory_test.go:
##########
@@ -159,7 +153,13 @@ func Test_RefreshUrl(t *testing.T) {
func normalRegistryDir(noMockEvent ...bool) (*RegistryDirectory, *registry.MockRegistry) {
extension.SetProtocol(protocolwrapper.FILTER, protocolwrapper.NewMockProtocolFilter)
- url, _ := common.NewURL("mock://127.0.0.1:1111")
+ applicationConfig := &global.ApplicationConfig{
+ Name: "test-application",
+ }
+
+ url, _ := common.NewURL("mock://127.0.0.1:1111",
+ common.WithAttribute(constant.ApplicationKey, applicationConfig),
+ )
Review Comment:
This single test is good,
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: replace application use of config package to global package in directory of registry [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #2942:
URL: https://github.com/apache/dubbo-go/pull/2942#issuecomment-3124285985
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=2942) **Quality Gate passed**
Issues
 [1 New issue](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2942&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2942&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2942&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2942&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2942&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=2942)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: replace application use of config package to global package in directory of registry [dubbo-go]
Posted by "marsevilspirit (via GitHub)" <gi...@apache.org>.
marsevilspirit commented on code in PR #2942:
URL: https://github.com/apache/dubbo-go/pull/2942#discussion_r2189843964
##########
registry/directory/directory_test.go:
##########
@@ -188,6 +182,7 @@ func normalRegistryDir(noMockEvent ...bool) (*RegistryDirectory, *registry.MockR
}
func TestToGroupInvokers(t *testing.T) {
+
Review Comment:
Please delete unnecessary blank lines.
##########
registry/directory/directory.go:
##########
@@ -575,14 +576,27 @@ type consumerConfigurationListener struct {
directory *RegistryDirectory
}
-func newConsumerConfigurationListener(dir *RegistryDirectory) *consumerConfigurationListener {
+func newConsumerConfigurationListener(dir *RegistryDirectory, url *common.URL) *consumerConfigurationListener {
listener := &consumerConfigurationListener{directory: dir}
+
+ // TODO: Temporary compatibility with old APIs, can be removed later
application := config.GetRootConfig().Application
listener.InitWith(
application.Name+constant.ConfiguratorSuffix,
listener,
extension.GetDefaultConfiguratorFunc(),
)
+
+ if ApplicationConfRaw, ok := url.GetAttribute(constant.ApplicationKey); ok {
Review Comment:
You did not set the Application Config in the Attribute field of the URL, so you won't get anything with get attribute.

You should try testing the code you wrote yourself to see if it works.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org