You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2020/12/21 07:14:51 UTC

[GitHub] [dubbo-go] cvictory opened a new pull request #948: Fix: make metadata report work without serviceDiscovery

cvictory opened a new pull request #948:
URL: https://github.com/apache/dubbo-go/pull/948


   <!--  Thanks for sending a pull request!
   Read https://github.com/apache/dubbo-go/blob/master/contributing.md before commit pull request. 
   -->
   
   **What this PR does**:
   
   The metadata should work  without ServiceDiscovery. So I think should add some logic in service_config.go and reference_config.go
   
   **Which issue(s) this PR fixes**:
   <!--
   *Automatically closes linked issue when PR is merged.
   Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
   _If PR is about `failing-tests or flakes`, please post the related issues/tests in a comment and do not use `Fixes`_*
   -->
   Fixes #
   
   **Special notes for your reviewer**:
   
   **Does this PR introduce a user-facing change?**:
   <!--
   If no, just write "NONE" in the release-note block below.
   If yes, a release note is required:
   Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required".
   -->
   ```release-note
   
   ```


----------------------------------------------------------------
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.

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


[GitHub] [dubbo-go] codecov-io edited a comment on pull request #948: Fix: make metadata report work without serviceDiscovery

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #948:
URL: https://github.com/apache/dubbo-go/pull/948#issuecomment-748812294


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=h1) Report
   > Merging [#948](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=desc) (785e323) into [develop](https://codecov.io/gh/apache/dubbo-go/commit/f244915b588c59664b2473e7019fc5c1aba78cb7?el=desc) (f244915) will **decrease** coverage by `0.35%`.
   > The diff coverage is `5.26%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/948/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL)](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           develop     #948      +/-   ##
   ===========================================
   - Coverage    60.27%   59.91%   -0.36%     
   ===========================================
     Files          260      260              
     Lines        12886    12918      +32     
   ===========================================
   - Hits          7767     7740      -27     
   - Misses        4160     4217      +57     
   - Partials       959      961       +2     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [common/extension/metadata\_service.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-Y29tbW9uL2V4dGVuc2lvbi9tZXRhZGF0YV9zZXJ2aWNlLmdv) | `0.00% <0.00%> (ø)` | |
   | [metadata/report/delegate/delegate\_report.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-bWV0YWRhdGEvcmVwb3J0L2RlbGVnYXRlL2RlbGVnYXRlX3JlcG9ydC5nbw==) | `28.92% <0.00%> (-10.91%)` | :arrow_down: |
   | [metadata/service/remote/service.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-bWV0YWRhdGEvc2VydmljZS9yZW1vdGUvc2VydmljZS5nbw==) | `32.95% <0.00%> (-6.78%)` | :arrow_down: |
   | [config/reference\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-Y29uZmlnL3JlZmVyZW5jZV9jb25maWcuZ28=) | `80.19% <33.33%> (-1.44%)` | :arrow_down: |
   | [config/service\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-Y29uZmlnL3NlcnZpY2VfY29uZmlnLmdv) | `62.06% <33.33%> (-0.61%)` | :arrow_down: |
   | [remoting/kubernetes/registry\_controller.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-cmVtb3Rpbmcva3ViZXJuZXRlcy9yZWdpc3RyeV9jb250cm9sbGVyLmdv) | `46.12% <0.00%> (-5.31%)` | :arrow_down: |
   | [cluster/cluster\_impl/failback\_cluster\_invoker.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-Y2x1c3Rlci9jbHVzdGVyX2ltcGwvZmFpbGJhY2tfY2x1c3Rlcl9pbnZva2VyLmdv) | `75.90% <0.00%> (-2.41%)` | :arrow_down: |
   | [remoting/kubernetes/watch.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-cmVtb3Rpbmcva3ViZXJuZXRlcy93YXRjaC5nbw==) | `77.17% <0.00%> (-2.18%)` | :arrow_down: |
   | [remoting/getty/pool.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-cmVtb3RpbmcvZ2V0dHkvcG9vbC5nbw==) | `68.72% <0.00%> (-0.89%)` | :arrow_down: |
   | ... and [2 more](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=footer). Last update [f244915...5a7f093](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
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.

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


[GitHub] [dubbo-go] codecov-io edited a comment on pull request #948: Fix: make metadata report work without serviceDiscovery

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #948:
URL: https://github.com/apache/dubbo-go/pull/948#issuecomment-748812294


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=h1) Report
   > Merging [#948](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=desc) (9a980ff) into [develop](https://codecov.io/gh/apache/dubbo-go/commit/0cb6edb4dd989696cc56b10259b1e0a146f1c54d?el=desc) (0cb6edb) will **decrease** coverage by `0.12%`.
   > The diff coverage is `10.86%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/948/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL)](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           develop     #948      +/-   ##
   ===========================================
   - Coverage    59.66%   59.53%   -0.13%     
   ===========================================
     Files          261      261              
     Lines        12919    12952      +33     
   ===========================================
   + Hits          7708     7711       +3     
   - Misses        4240     4268      +28     
   - Partials       971      973       +2     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [common/extension/metadata\_service.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-Y29tbW9uL2V4dGVuc2lvbi9tZXRhZGF0YV9zZXJ2aWNlLmdv) | `0.00% <0.00%> (ø)` | |
   | [config/service\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-Y29uZmlnL3NlcnZpY2VfY29uZmlnLmdv) | `53.59% <0.00%> (-1.08%)` | :arrow_down: |
   | [filter/filter\_impl/sentinel\_filter.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-ZmlsdGVyL2ZpbHRlcl9pbXBsL3NlbnRpbmVsX2ZpbHRlci5nbw==) | `63.04% <ø> (ø)` | |
   | [metadata/report/delegate/delegate\_report.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-bWV0YWRhdGEvcmVwb3J0L2RlbGVnYXRlL2RlbGVnYXRlX3JlcG9ydC5nbw==) | `27.34% <0.00%> (-0.66%)` | :arrow_down: |
   | [metadata/service/remote/service.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-bWV0YWRhdGEvc2VydmljZS9yZW1vdGUvc2VydmljZS5nbw==) | `32.95% <0.00%> (-6.78%)` | :arrow_down: |
   | [...try/servicediscovery/service\_discovery\_registry.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-cmVnaXN0cnkvc2VydmljZWRpc2NvdmVyeS9zZXJ2aWNlX2Rpc2NvdmVyeV9yZWdpc3RyeS5nbw==) | `11.56% <ø> (-0.21%)` | :arrow_down: |
   | [config/reference\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-Y29uZmlnL3JlZmVyZW5jZV9jb25maWcuZ28=) | `78.84% <33.33%> (-1.36%)` | :arrow_down: |
   | [registry/nacos/registry.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-cmVnaXN0cnkvbmFjb3MvcmVnaXN0cnkuZ28=) | `50.36% <57.14%> (-0.77%)` | :arrow_down: |
   | [...tocol/rest/server/server\_impl/go\_restful\_server.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-cHJvdG9jb2wvcmVzdC9zZXJ2ZXIvc2VydmVyX2ltcGwvZ29fcmVzdGZ1bF9zZXJ2ZXIuZ28=) | `48.78% <0.00%> (+4.87%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=footer). Last update [9a666eb...9a980ff](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
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.

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


[GitHub] [dubbo-go] Patrick0308 commented on a change in pull request #948: Fix: make metadata report work without serviceDiscovery

Posted by GitBox <gi...@apache.org>.
Patrick0308 commented on a change in pull request #948:
URL: https://github.com/apache/dubbo-go/pull/948#discussion_r561649026



##########
File path: metadata/service/remote/service.go
##########
@@ -116,22 +116,41 @@ func (mts *MetadataService) UnsubscribeURL(url *common.URL) error {
 func (mts *MetadataService) PublishServiceDefinition(url *common.URL) error {
 	interfaceName := url.GetParam(constant.INTERFACE_KEY, "")
 	isGeneric := url.GetParamBool(constant.GENERIC_KEY, false)
-	if len(interfaceName) > 0 && !isGeneric {
-		sv := common.ServiceMap.GetServiceByServiceKey(url.Protocol, url.ServiceKey())
-		sd := definition.BuildServiceDefinition(*sv, url)
+	if common.RoleType(common.PROVIDER).Role() == url.GetParam(constant.SIDE_KEY, "") {
+		if len(interfaceName) > 0 && !isGeneric {
+			sv := common.ServiceMap.GetServiceByServiceKey(url.Protocol, url.ServiceKey())
+			sd := definition.BuildServiceDefinition(*sv, url)
+			id := &identifier.MetadataIdentifier{
+				BaseMetadataIdentifier: identifier.BaseMetadataIdentifier{
+					ServiceInterface: interfaceName,
+					Version:          url.GetParam(constant.VERSION_KEY, ""),
+					Group:            url.GetParam(constant.GROUP_KEY, constant.DUBBO),
+					Side:             url.GetParam(constant.SIDE_KEY, "provider"),
+				},
+			}
+			mts.delegateReport.StoreProviderMetadata(id, sd)
+			return nil
+		}
+		logger.Errorf("publishProvider interfaceName is empty . providerUrl:%v ", url)
+	} else {
+		params := make(map[string]string, len(url.GetParams()))
+		url.RangeParams(func(key, value string) bool {
+			params[key] = value
+			return true
+		})
 		id := &identifier.MetadataIdentifier{
 			BaseMetadataIdentifier: identifier.BaseMetadataIdentifier{
 				ServiceInterface: interfaceName,
 				Version:          url.GetParam(constant.VERSION_KEY, ""),
 				// Group:            url.GetParam(constant.GROUP_KEY, constant.SERVICE_DISCOVERY_DEFAULT_GROUP),

Review comment:
       pls remove it.




----------------------------------------------------------------
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.

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


[GitHub] [dubbo-go] cityiron commented on pull request #948: Fix: make metadata report work without serviceDiscovery

Posted by GitBox <gi...@apache.org>.
cityiron commented on pull request #948:
URL: https://github.com/apache/dubbo-go/pull/948#issuecomment-763596056


   This pr is resolve  issue#939?


----------------------------------------------------------------
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.

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


[GitHub] [dubbo-go] AlexStocks commented on a change in pull request #948: Fix: make metadata report work without serviceDiscovery

Posted by GitBox <gi...@apache.org>.
AlexStocks commented on a change in pull request #948:
URL: https://github.com/apache/dubbo-go/pull/948#discussion_r547070488



##########
File path: common/extension/metadata_service.go
##########
@@ -48,3 +51,17 @@ func GetMetadataService(msType string) (service.MetadataService, error) {
 		"local - github.com/apache/dubbo-go/metadata/service/inmemory, \n"+
 		"remote - github.com/apache/dubbo-go/metadata/service/remote", msType))
 }
+
+// GetRemoteMetadataService will get a RemoteMetadataService instance
+func GetRemoteMetadataService() (service.MetadataService, error) {
+	if remoteMetadataService != nil {
+		return remoteMetadataService, nil
+	}
+	if creator, ok := metadataServiceInsMap["remote"]; ok {
+		var err error
+		remoteMetadataService, err = creator()
+		return remoteMetadataService, err

Review comment:
       using 'return creator()' instead of the above 3 lines codes.




----------------------------------------------------------------
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.

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


[GitHub] [dubbo-go] codecov-io commented on pull request #948: Fix: make metadata report work without serviceDiscovery

Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #948:
URL: https://github.com/apache/dubbo-go/pull/948#issuecomment-748812294


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=h1) Report
   > Merging [#948](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=desc) (b2b70d2) into [develop](https://codecov.io/gh/apache/dubbo-go/commit/f244915b588c59664b2473e7019fc5c1aba78cb7?el=desc) (f244915) will **decrease** coverage by `0.01%`.
   > The diff coverage is `60.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/948/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL)](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           develop     #948      +/-   ##
   ===========================================
   - Coverage    60.27%   60.25%   -0.02%     
   ===========================================
     Files          260      260              
     Lines        12886    12896      +10     
   ===========================================
   + Hits          7767     7771       +4     
   - Misses        4160     4163       +3     
   - Partials       959      962       +3     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [config/service\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-Y29uZmlnL3NlcnZpY2VfY29uZmlnLmdv) | `62.50% <60.00%> (-0.18%)` | :arrow_down: |
   | [cluster/cluster\_impl/failback\_cluster\_invoker.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-Y2x1c3Rlci9jbHVzdGVyX2ltcGwvZmFpbGJhY2tfY2x1c3Rlcl9pbnZva2VyLmdv) | `75.90% <0.00%> (-2.41%)` | :arrow_down: |
   | [remoting/getty/pool.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-cmVtb3RpbmcvZ2V0dHkvcG9vbC5nbw==) | `68.72% <0.00%> (-0.89%)` | :arrow_down: |
   | [protocol/dubbo/impl/hessian.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-cHJvdG9jb2wvZHViYm8vaW1wbC9oZXNzaWFuLmdv) | `29.17% <0.00%> (ø)` | |
   | [cluster/router/chain/chain.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY2hhaW4vY2hhaW4uZ28=) | `70.16% <0.00%> (+1.61%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=footer). Last update [f244915...5a7f093](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
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.

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


[GitHub] [dubbo-go] codecov-io edited a comment on pull request #948: Fix: make metadata report work without serviceDiscovery

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #948:
URL: https://github.com/apache/dubbo-go/pull/948#issuecomment-748812294


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=h1) Report
   > Merging [#948](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=desc) (c8fb3e9) into [develop](https://codecov.io/gh/apache/dubbo-go/commit/374a01a37d527067383664ee26088a870bbeaf5d?el=desc) (374a01a) will **decrease** coverage by `0.04%`.
   > The diff coverage is `2.63%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/948/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL)](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           develop     #948      +/-   ##
   ===========================================
   - Coverage    59.59%   59.54%   -0.05%     
   ===========================================
     Files          261      261              
     Lines        12903    12957      +54     
   ===========================================
   + Hits          7689     7715      +26     
   - Misses        4243     4266      +23     
   - Partials       971      976       +5     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [common/extension/metadata\_service.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-Y29tbW9uL2V4dGVuc2lvbi9tZXRhZGF0YV9zZXJ2aWNlLmdv) | `0.00% <0.00%> (ø)` | |
   | [config/service\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-Y29uZmlnL3NlcnZpY2VfY29uZmlnLmdv) | `53.59% <0.00%> (-1.08%)` | :arrow_down: |
   | [metadata/report/delegate/delegate\_report.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-bWV0YWRhdGEvcmVwb3J0L2RlbGVnYXRlL2RlbGVnYXRlX3JlcG9ydC5nbw==) | `36.71% <0.00%> (+8.71%)` | :arrow_up: |
   | [metadata/service/remote/service.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-bWV0YWRhdGEvc2VydmljZS9yZW1vdGUvc2VydmljZS5nbw==) | `32.95% <0.00%> (-6.78%)` | :arrow_down: |
   | [config/reference\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-Y29uZmlnL3JlZmVyZW5jZV9jb25maWcuZ28=) | `78.84% <33.33%> (-1.36%)` | :arrow_down: |
   | [cluster/cluster\_impl/base\_cluster\_invoker.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-Y2x1c3Rlci9jbHVzdGVyX2ltcGwvYmFzZV9jbHVzdGVyX2ludm9rZXIuZ28=) | `52.77% <0.00%> (-8.34%)` | :arrow_down: |
   | [...tocol/rest/server/server\_impl/go\_restful\_server.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-cHJvdG9jb2wvcmVzdC9zZXJ2ZXIvc2VydmVyX2ltcGwvZ29fcmVzdGZ1bF9zZXJ2ZXIuZ28=) | `43.90% <0.00%> (-4.88%)` | :arrow_down: |
   | [config\_center/file/impl.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-Y29uZmlnX2NlbnRlci9maWxlL2ltcGwuZ28=) | `50.40% <0.00%> (-2.07%)` | :arrow_down: |
   | [remoting/kubernetes/listener.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-cmVtb3Rpbmcva3ViZXJuZXRlcy9saXN0ZW5lci5nbw==) | `50.52% <0.00%> (ø)` | |
   | [remoting/kubernetes/watch.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-cmVtb3Rpbmcva3ViZXJuZXRlcy93YXRjaC5nbw==) | `79.12% <0.00%> (+2.19%)` | :arrow_up: |
   | ... and [3 more](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=footer). Last update [374a01a...c8fb3e9](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
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.

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


[GitHub] [dubbo-go] codecov-io edited a comment on pull request #948: Fix: make metadata report work without serviceDiscovery

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #948:
URL: https://github.com/apache/dubbo-go/pull/948#issuecomment-748812294


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=h1) Report
   > Merging [#948](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=desc) (5a7f093) into [develop](https://codecov.io/gh/apache/dubbo-go/commit/f244915b588c59664b2473e7019fc5c1aba78cb7?el=desc) (f244915) will **decrease** coverage by `0.31%`.
   > The diff coverage is `5.26%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/948/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL)](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           develop     #948      +/-   ##
   ===========================================
   - Coverage    60.27%   59.96%   -0.32%     
   ===========================================
     Files          260      260              
     Lines        12886    12918      +32     
   ===========================================
   - Hits          7767     7746      -21     
   - Misses        4160     4206      +46     
   - Partials       959      966       +7     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [common/extension/metadata\_service.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-Y29tbW9uL2V4dGVuc2lvbi9tZXRhZGF0YV9zZXJ2aWNlLmdv) | `0.00% <0.00%> (ø)` | |
   | [metadata/report/delegate/delegate\_report.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-bWV0YWRhdGEvcmVwb3J0L2RlbGVnYXRlL2RlbGVnYXRlX3JlcG9ydC5nbw==) | `28.92% <0.00%> (-10.91%)` | :arrow_down: |
   | [metadata/service/remote/service.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-bWV0YWRhdGEvc2VydmljZS9yZW1vdGUvc2VydmljZS5nbw==) | `32.95% <0.00%> (-6.78%)` | :arrow_down: |
   | [config/reference\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-Y29uZmlnL3JlZmVyZW5jZV9jb25maWcuZ28=) | `80.19% <33.33%> (-1.44%)` | :arrow_down: |
   | [config/service\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-Y29uZmlnL3NlcnZpY2VfY29uZmlnLmdv) | `62.06% <33.33%> (-0.61%)` | :arrow_down: |
   | [...tocol/rest/server/server\_impl/go\_restful\_server.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-cHJvdG9jb2wvcmVzdC9zZXJ2ZXIvc2VydmVyX2ltcGwvZ29fcmVzdGZ1bF9zZXJ2ZXIuZ28=) | `43.90% <0.00%> (-4.88%)` | :arrow_down: |
   | [remoting/kubernetes/watch.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-cmVtb3Rpbmcva3ViZXJuZXRlcy93YXRjaC5nbw==) | `75.00% <0.00%> (-4.35%)` | :arrow_down: |
   | [remoting/kubernetes/client.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-cmVtb3Rpbmcva3ViZXJuZXRlcy9jbGllbnQuZ28=) | `72.72% <0.00%> (-3.04%)` | :arrow_down: |
   | [remoting/kubernetes/registry\_controller.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-cmVtb3Rpbmcva3ViZXJuZXRlcy9yZWdpc3RyeV9jb250cm9sbGVyLmdv) | `50.20% <0.00%> (-1.23%)` | :arrow_down: |
   | ... and [4 more](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=footer). Last update [f244915...5a7f093](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
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.

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


[GitHub] [dubbo-go] fangyincheng commented on a change in pull request #948: Fix: make metadata report work without serviceDiscovery

Posted by GitBox <gi...@apache.org>.
fangyincheng commented on a change in pull request #948:
URL: https://github.com/apache/dubbo-go/pull/948#discussion_r549085991



##########
File path: common/extension/metadata_service.go
##########
@@ -48,3 +51,17 @@ func GetMetadataService(msType string) (service.MetadataService, error) {
 		"local - github.com/apache/dubbo-go/metadata/service/inmemory, \n"+
 		"remote - github.com/apache/dubbo-go/metadata/service/remote", msType))
 }
+
+// GetRemoteMetadataService will get a RemoteMetadataService instance
+func GetRemoteMetadataService() (service.MetadataService, error) {
+	if remoteMetadataService != nil {
+		return remoteMetadataService, nil
+	}
+	if creator, ok := metadataServiceInsMap["remote"]; ok {
+		var err error
+		remoteMetadataService, err = creator()
+		return remoteMetadataService, err
+	}
+	logger.Info("could not find the metadata service creator for metadataType: remote")

Review comment:
       it should be `warm`?

##########
File path: metadata/service/remote/service.go
##########
@@ -114,22 +114,42 @@ func (mts *MetadataService) UnsubscribeURL(url *common.URL) error {
 func (mts *MetadataService) PublishServiceDefinition(url *common.URL) error {
 	interfaceName := url.GetParam(constant.INTERFACE_KEY, "")
 	isGeneric := url.GetParamBool(constant.GENERIC_KEY, false)
-	if len(interfaceName) > 0 && !isGeneric {
-		sv := common.ServiceMap.GetServiceByServiceKey(url.Protocol, url.ServiceKey())
-		sd := definition.BuildServiceDefinition(*sv, url)
+	if common.RoleType(common.PROVIDER).Role() == url.GetParam(constant.SIDE_KEY, "") {
+		if len(interfaceName) > 0 && !isGeneric {
+			sv := common.ServiceMap.GetServiceByServiceKey(url.Protocol, url.ServiceKey())
+			sd := definition.BuildServiceDefinition(*sv, url)
+			id := &identifier.MetadataIdentifier{
+				BaseMetadataIdentifier: identifier.BaseMetadataIdentifier{
+					ServiceInterface: interfaceName,
+					Version:          url.GetParam(constant.VERSION_KEY, ""),
+					// Group:            url.GetParam(constant.GROUP_KEY, constant.SERVICE_DISCOVERY_DEFAULT_GROUP),

Review comment:
       if not use, pls remove it




----------------------------------------------------------------
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.

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


[GitHub] [dubbo-go] cvictory commented on a change in pull request #948: Fix: make metadata report work without serviceDiscovery

Posted by GitBox <gi...@apache.org>.
cvictory commented on a change in pull request #948:
URL: https://github.com/apache/dubbo-go/pull/948#discussion_r547081587



##########
File path: common/extension/metadata_service.go
##########
@@ -48,3 +51,17 @@ func GetMetadataService(msType string) (service.MetadataService, error) {
 		"local - github.com/apache/dubbo-go/metadata/service/inmemory, \n"+
 		"remote - github.com/apache/dubbo-go/metadata/service/remote", msType))
 }
+
+// GetRemoteMetadataService will get a RemoteMetadataService instance
+func GetRemoteMetadataService() (service.MetadataService, error) {
+	if remoteMetadataService != nil {
+		return remoteMetadataService, nil
+	}
+	if creator, ok := metadataServiceInsMap["remote"]; ok {
+		var err error
+		remoteMetadataService, err = creator()
+		return remoteMetadataService, err

Review comment:
       It should set remoteMetadataService.




----------------------------------------------------------------
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.

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


[GitHub] [dubbo-go] watermelo commented on a change in pull request #948: Fix: make metadata report work without serviceDiscovery

Posted by GitBox <gi...@apache.org>.
watermelo commented on a change in pull request #948:
URL: https://github.com/apache/dubbo-go/pull/948#discussion_r563167922



##########
File path: metadata/service/remote/service.go
##########
@@ -116,22 +116,40 @@ func (mts *MetadataService) UnsubscribeURL(url *common.URL) error {
 func (mts *MetadataService) PublishServiceDefinition(url *common.URL) error {

Review comment:
       The value of `error` always return `nil`.




----------------------------------------------------------------
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.

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


[GitHub] [dubbo-go] Patrick0308 commented on a change in pull request #948: Fix: make metadata report work without serviceDiscovery

Posted by GitBox <gi...@apache.org>.
Patrick0308 commented on a change in pull request #948:
URL: https://github.com/apache/dubbo-go/pull/948#discussion_r561649026



##########
File path: metadata/service/remote/service.go
##########
@@ -116,22 +116,41 @@ func (mts *MetadataService) UnsubscribeURL(url *common.URL) error {
 func (mts *MetadataService) PublishServiceDefinition(url *common.URL) error {
 	interfaceName := url.GetParam(constant.INTERFACE_KEY, "")
 	isGeneric := url.GetParamBool(constant.GENERIC_KEY, false)
-	if len(interfaceName) > 0 && !isGeneric {
-		sv := common.ServiceMap.GetServiceByServiceKey(url.Protocol, url.ServiceKey())
-		sd := definition.BuildServiceDefinition(*sv, url)
+	if common.RoleType(common.PROVIDER).Role() == url.GetParam(constant.SIDE_KEY, "") {
+		if len(interfaceName) > 0 && !isGeneric {
+			sv := common.ServiceMap.GetServiceByServiceKey(url.Protocol, url.ServiceKey())
+			sd := definition.BuildServiceDefinition(*sv, url)
+			id := &identifier.MetadataIdentifier{
+				BaseMetadataIdentifier: identifier.BaseMetadataIdentifier{
+					ServiceInterface: interfaceName,
+					Version:          url.GetParam(constant.VERSION_KEY, ""),
+					Group:            url.GetParam(constant.GROUP_KEY, constant.DUBBO),
+					Side:             url.GetParam(constant.SIDE_KEY, "provider"),
+				},
+			}
+			mts.delegateReport.StoreProviderMetadata(id, sd)
+			return nil
+		}
+		logger.Errorf("publishProvider interfaceName is empty . providerUrl:%v ", url)
+	} else {
+		params := make(map[string]string, len(url.GetParams()))
+		url.RangeParams(func(key, value string) bool {
+			params[key] = value
+			return true
+		})
 		id := &identifier.MetadataIdentifier{
 			BaseMetadataIdentifier: identifier.BaseMetadataIdentifier{
 				ServiceInterface: interfaceName,
 				Version:          url.GetParam(constant.VERSION_KEY, ""),
 				// Group:            url.GetParam(constant.GROUP_KEY, constant.SERVICE_DISCOVERY_DEFAULT_GROUP),

Review comment:
       pls remove it.




----------------------------------------------------------------
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.

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


[GitHub] [dubbo-go] AlexStocks merged pull request #948: Fix: make metadata report work without serviceDiscovery

Posted by GitBox <gi...@apache.org>.
AlexStocks merged pull request #948:
URL: https://github.com/apache/dubbo-go/pull/948


   


----------------------------------------------------------------
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.

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


[GitHub] [dubbo-go] codecov-io edited a comment on pull request #948: Fix: make metadata report work without serviceDiscovery

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #948:
URL: https://github.com/apache/dubbo-go/pull/948#issuecomment-748812294


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=h1) Report
   > Merging [#948](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=desc) (785e323) into [develop](https://codecov.io/gh/apache/dubbo-go/commit/374a01a37d527067383664ee26088a870bbeaf5d?el=desc) (374a01a) will **increase** coverage by `0.32%`.
   > The diff coverage is `5.26%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/948/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL)](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           develop     #948      +/-   ##
   ===========================================
   + Coverage    59.59%   59.91%   +0.32%     
   ===========================================
     Files          261      260       -1     
     Lines        12903    12918      +15     
   ===========================================
   + Hits          7689     7740      +51     
   + Misses        4243     4217      -26     
   + Partials       971      961      -10     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [common/extension/metadata\_service.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-Y29tbW9uL2V4dGVuc2lvbi9tZXRhZGF0YV9zZXJ2aWNlLmdv) | `0.00% <0.00%> (ø)` | |
   | [metadata/report/delegate/delegate\_report.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-bWV0YWRhdGEvcmVwb3J0L2RlbGVnYXRlL2RlbGVnYXRlX3JlcG9ydC5nbw==) | `28.92% <0.00%> (+0.92%)` | :arrow_up: |
   | [metadata/service/remote/service.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-bWV0YWRhdGEvc2VydmljZS9yZW1vdGUvc2VydmljZS5nbw==) | `32.95% <0.00%> (-6.78%)` | :arrow_down: |
   | [config/reference\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-Y29uZmlnL3JlZmVyZW5jZV9jb25maWcuZ28=) | `80.19% <33.33%> (ø)` | |
   | [config/service\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-Y29uZmlnL3NlcnZpY2VfY29uZmlnLmdv) | `62.06% <33.33%> (+7.40%)` | :arrow_up: |
   | [protocol/dubbo/opentracing.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-cHJvdG9jb2wvZHViYm8vb3BlbnRyYWNpbmcuZ28=) | `73.33% <0.00%> (-26.67%)` | :arrow_down: |
   | [remoting/getty/opentracing.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-cmVtb3RpbmcvZ2V0dHkvb3BlbnRyYWNpbmcuZ28=) | `73.33% <0.00%> (-26.67%)` | :arrow_down: |
   | [cluster/router/tag/router\_rule.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvdGFnL3JvdXRlcl9ydWxlLmdv) | `77.27% <0.00%> (-12.21%)` | :arrow_down: |
   | [...nthesizer/rest/rest\_subscribed\_urls\_synthesizer.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-cmVnaXN0cnkvc2VydmljZWRpc2NvdmVyeS9zeW50aGVzaXplci9yZXN0L3Jlc3Rfc3Vic2NyaWJlZF91cmxzX3N5bnRoZXNpemVyLmdv) | `81.25% <0.00%> (-11.61%)` | :arrow_down: |
   | [remoting/kubernetes/registry\_controller.go](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree#diff-cmVtb3Rpbmcva3ViZXJuZXRlcy9yZWdpc3RyeV9jb250cm9sbGVyLmdv) | `46.12% <0.00%> (-5.31%)` | :arrow_down: |
   | ... and [46 more](https://codecov.io/gh/apache/dubbo-go/pull/948/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=footer). Last update [374a01a...c8fb3e9](https://codecov.io/gh/apache/dubbo-go/pull/948?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
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.

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


[GitHub] [dubbo-go] cityiron commented on a change in pull request #948: Fix: make metadata report work without serviceDiscovery

Posted by GitBox <gi...@apache.org>.
cityiron commented on a change in pull request #948:
URL: https://github.com/apache/dubbo-go/pull/948#discussion_r560242458



##########
File path: metadata/service/remote/service.go
##########
@@ -116,22 +116,41 @@ func (mts *MetadataService) UnsubscribeURL(url *common.URL) error {
 func (mts *MetadataService) PublishServiceDefinition(url *common.URL) error {
 	interfaceName := url.GetParam(constant.INTERFACE_KEY, "")
 	isGeneric := url.GetParamBool(constant.GENERIC_KEY, false)
-	if len(interfaceName) > 0 && !isGeneric {
-		sv := common.ServiceMap.GetServiceByServiceKey(url.Protocol, url.ServiceKey())
-		sd := definition.BuildServiceDefinition(*sv, url)
+	if common.RoleType(common.PROVIDER).Role() == url.GetParam(constant.SIDE_KEY, "") {
+		if len(interfaceName) > 0 && !isGeneric {
+			sv := common.ServiceMap.GetServiceByServiceKey(url.Protocol, url.ServiceKey())
+			sd := definition.BuildServiceDefinition(*sv, url)
+			id := &identifier.MetadataIdentifier{
+				BaseMetadataIdentifier: identifier.BaseMetadataIdentifier{
+					ServiceInterface: interfaceName,
+					Version:          url.GetParam(constant.VERSION_KEY, ""),
+					Group:            url.GetParam(constant.GROUP_KEY, constant.DUBBO),
+					Side:             url.GetParam(constant.SIDE_KEY, "provider"),
+				},
+			}
+			mts.delegateReport.StoreProviderMetadata(id, sd)
+			return nil
+		}
+		logger.Errorf("publishProvider interfaceName is empty . providerUrl:%v ", url)
+	} else {
+		params := make(map[string]string, len(url.GetParams()))
+		url.RangeParams(func(key, value string) bool {
+			params[key] = value
+			return true
+		})
 		id := &identifier.MetadataIdentifier{
 			BaseMetadataIdentifier: identifier.BaseMetadataIdentifier{
 				ServiceInterface: interfaceName,
 				Version:          url.GetParam(constant.VERSION_KEY, ""),
 				// Group:            url.GetParam(constant.GROUP_KEY, constant.SERVICE_DISCOVERY_DEFAULT_GROUP),
 				Group: url.GetParam(constant.GROUP_KEY, constant.DUBBO),
-				Side:  url.GetParam(constant.SIDE_KEY, "provider"),
+				Side:  url.GetParam(constant.SIDE_KEY, "consumer"),

Review comment:
       SIDE_KEY  consumer and provider shoud refer from constant




----------------------------------------------------------------
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.

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


[GitHub] [dubbo-go] cityiron commented on a change in pull request #948: Fix: make metadata report work without serviceDiscovery

Posted by GitBox <gi...@apache.org>.
cityiron commented on a change in pull request #948:
URL: https://github.com/apache/dubbo-go/pull/948#discussion_r560242458



##########
File path: metadata/service/remote/service.go
##########
@@ -116,22 +116,41 @@ func (mts *MetadataService) UnsubscribeURL(url *common.URL) error {
 func (mts *MetadataService) PublishServiceDefinition(url *common.URL) error {
 	interfaceName := url.GetParam(constant.INTERFACE_KEY, "")
 	isGeneric := url.GetParamBool(constant.GENERIC_KEY, false)
-	if len(interfaceName) > 0 && !isGeneric {
-		sv := common.ServiceMap.GetServiceByServiceKey(url.Protocol, url.ServiceKey())
-		sd := definition.BuildServiceDefinition(*sv, url)
+	if common.RoleType(common.PROVIDER).Role() == url.GetParam(constant.SIDE_KEY, "") {
+		if len(interfaceName) > 0 && !isGeneric {
+			sv := common.ServiceMap.GetServiceByServiceKey(url.Protocol, url.ServiceKey())
+			sd := definition.BuildServiceDefinition(*sv, url)
+			id := &identifier.MetadataIdentifier{
+				BaseMetadataIdentifier: identifier.BaseMetadataIdentifier{
+					ServiceInterface: interfaceName,
+					Version:          url.GetParam(constant.VERSION_KEY, ""),
+					Group:            url.GetParam(constant.GROUP_KEY, constant.DUBBO),
+					Side:             url.GetParam(constant.SIDE_KEY, "provider"),
+				},
+			}
+			mts.delegateReport.StoreProviderMetadata(id, sd)
+			return nil
+		}
+		logger.Errorf("publishProvider interfaceName is empty . providerUrl:%v ", url)
+	} else {
+		params := make(map[string]string, len(url.GetParams()))
+		url.RangeParams(func(key, value string) bool {
+			params[key] = value
+			return true
+		})
 		id := &identifier.MetadataIdentifier{
 			BaseMetadataIdentifier: identifier.BaseMetadataIdentifier{
 				ServiceInterface: interfaceName,
 				Version:          url.GetParam(constant.VERSION_KEY, ""),
 				// Group:            url.GetParam(constant.GROUP_KEY, constant.SERVICE_DISCOVERY_DEFAULT_GROUP),
 				Group: url.GetParam(constant.GROUP_KEY, constant.DUBBO),
-				Side:  url.GetParam(constant.SIDE_KEY, "provider"),
+				Side:  url.GetParam(constant.SIDE_KEY, "consumer"),

Review comment:
       SIDE_KEY  consumer and provider should refer from constant




----------------------------------------------------------------
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.

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