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 2021/11/28 10:14:18 UTC
[GitHub] [dubbo-go] chuntaojun opened a new pull request #1620: [ISSUE #1601] Feat issue 1601
chuntaojun opened a new pull request #1620:
URL: https://github.com/apache/dubbo-go/pull/1620
<!-- 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**:
support dubbo-go can set polaris to registry
**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 #1601
**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
support registry protocol can use polaris
```
--
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
[GitHub] [dubbo-go] codecov-commenter commented on pull request #1620: [ISSUE #1601] polarismesh registry center
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #1620:
URL: https://github.com/apache/dubbo-go/pull/1620#issuecomment-983232595
# [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#1620](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (9bf0356) into [3.0](https://codecov.io/gh/apache/dubbo-go/commit/a6aa373d6dd62d1948ab990f38d1b8c24356034f?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (a6aa373) will **increase** coverage by `0.18%`.
> The diff coverage is `77.77%`.
[](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## 3.0 #1620 +/- ##
==========================================
+ Coverage 40.93% 41.11% +0.18%
==========================================
Files 252 253 +1
Lines 14443 14479 +36
==========================================
+ Hits 5912 5953 +41
+ Misses 7850 7838 -12
- Partials 681 688 +7
```
| [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [remoting/polaris/builder.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3RpbmcvcG9sYXJpcy9idWlsZGVyLmdv) | `77.77% <77.77%> (ø)` | |
| [filter/metrics/filter.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZmlsdGVyL21ldHJpY3MvZmlsdGVyLmdv) | `85.00% <0.00%> (-15.00%)` | :arrow_down: |
| [metrics/prometheus/reporter.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bWV0cmljcy9wcm9tZXRoZXVzL3JlcG9ydGVyLmdv) | `28.57% <0.00%> (+1.71%)` | :arrow_up: |
| [metadata/report/delegate/delegate\_report.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bWV0YWRhdGEvcmVwb3J0L2RlbGVnYXRlL2RlbGVnYXRlX3JlcG9ydC5nbw==) | `35.09% <0.00%> (+8.60%)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [a6aa373...9bf0356](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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
[GitHub] [dubbo-go] LaurenceLiZhixin commented on pull request #1620: [ISSUE #1601] polarismesh registry center
Posted by GitBox <gi...@apache.org>.
LaurenceLiZhixin commented on pull request #1620:
URL: https://github.com/apache/dubbo-go/pull/1620#issuecomment-981303651
You can add a samples here: https://github.com/apache/dubbo-go-samples/tree/master/registry
--
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
[GitHub] [dubbo-go] AlexStocks commented on a change in pull request #1620: [ISSUE #1601] polarismesh registry center
Posted by GitBox <gi...@apache.org>.
AlexStocks commented on a change in pull request #1620:
URL: https://github.com/apache/dubbo-go/pull/1620#discussion_r760087089
##########
File path: registry/polaris/core.go
##########
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//@Author: chuntaojun <li...@live.com>
+//@Description:
+//@Time: 2021/11/26 00:28
+
+package polaris
+
+import (
+ "sync"
+ "time"
+)
+
+import (
+ gxchan "github.com/dubbogo/gost/container/chan"
+
+ "github.com/polarismesh/polaris-go/api"
+ "github.com/polarismesh/polaris-go/pkg/model"
+)
+
+import (
+ "dubbo.apache.org/dubbo-go/v3/config_center"
+ "dubbo.apache.org/dubbo-go/v3/remoting"
+)
+
+// PolarisServiceWatcher
+type PolarisServiceWatcher struct {
+ consumer api.ConsumerAPI
+ subscribeParam *api.WatchServiceRequest
+ events *gxchan.UnboundedChan
+ lock *sync.RWMutex
+ subscribers []func(remoting.EventType, []model.Instance)
+ execOnce *sync.Once
+}
+
+// newPolarisWatcher create PolarisServiceWatcher to do watch service action
+func newPolarisWatcher(param *api.WatchServiceRequest, consumer api.ConsumerAPI) (*PolarisServiceWatcher, error) {
+ watcher := &PolarisServiceWatcher{
+ subscribeParam: param,
+ consumer: consumer,
+ events: gxchan.NewUnboundedChan(1024),
+ lock: &sync.RWMutex{},
+ subscribers: make([]func(remoting.EventType, []model.Instance), 0),
+ execOnce: &sync.Once{},
+ }
+ return watcher, nil
+}
+
+// AddSubscriber add subscriber into watcher's subscribers
+func (watcher *PolarisServiceWatcher) AddSubscriber(subscriber func(remoting.EventType, []model.Instance)) {
+
+ watcher.lazyRun()
+
+ watcher.lock.Lock()
+ defer watcher.lock.Unlock()
+
+ watcher.subscribers = append(watcher.subscribers, subscriber)
+}
+
+// lazyRun Delayed execution, only triggered when AddSubscriber is called, and will only be executed once
+func (watcher *PolarisServiceWatcher) lazyRun() {
+ watcher.execOnce.Do(func() {
+ go watcher.startWatcher()
Review comment:
这俩函数就这么直接异步,不考虑使用同步原语吗?
--
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
[GitHub] [dubbo-go] AlexStocks commented on a change in pull request #1620: [ISSUE #1601] polarismesh registry center
Posted by GitBox <gi...@apache.org>.
AlexStocks commented on a change in pull request #1620:
URL: https://github.com/apache/dubbo-go/pull/1620#discussion_r760088227
##########
File path: registry/polaris/core.go
##########
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//@Author: chuntaojun <li...@live.com>
Review comment:
这里面所有的作者信息,全部删掉。git log 足以保存你的作者信息
--
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
[GitHub] [dubbo-go] chuntaojun commented on pull request #1620: [ISSUE #1601] polarismesh registry center
Posted by GitBox <gi...@apache.org>.
chuntaojun commented on pull request #1620:
URL: https://github.com/apache/dubbo-go/pull/1620#issuecomment-983252247
> imports block的问题我更新了下,目前ci过了。 整体看没有什么大问题。希望在dubbo-go-samples/registry/polaris 给出对应的例子。 @chuntaojun
这个我给了,我迟一些也一起提交下~
--
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
[GitHub] [dubbo-go] chuntaojun commented on a change in pull request #1620: [ISSUE #1601] polarismesh registry center
Posted by GitBox <gi...@apache.org>.
chuntaojun commented on a change in pull request #1620:
URL: https://github.com/apache/dubbo-go/pull/1620#discussion_r760104006
##########
File path: registry/polaris/core.go
##########
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//@Author: chuntaojun <li...@live.com>
+//@Description:
+//@Time: 2021/11/26 00:28
+
+package polaris
+
+import (
+ "sync"
+ "time"
+)
+
+import (
+ gxchan "github.com/dubbogo/gost/container/chan"
+
+ "github.com/polarismesh/polaris-go/api"
+ "github.com/polarismesh/polaris-go/pkg/model"
+)
+
+import (
+ "dubbo.apache.org/dubbo-go/v3/config_center"
+ "dubbo.apache.org/dubbo-go/v3/remoting"
+)
+
+// PolarisServiceWatcher
+type PolarisServiceWatcher struct {
+ consumer api.ConsumerAPI
+ subscribeParam *api.WatchServiceRequest
+ events *gxchan.UnboundedChan
+ lock *sync.RWMutex
+ subscribers []func(remoting.EventType, []model.Instance)
+ execOnce *sync.Once
+}
+
+// newPolarisWatcher create PolarisServiceWatcher to do watch service action
+func newPolarisWatcher(param *api.WatchServiceRequest, consumer api.ConsumerAPI) (*PolarisServiceWatcher, error) {
+ watcher := &PolarisServiceWatcher{
+ subscribeParam: param,
+ consumer: consumer,
+ events: gxchan.NewUnboundedChan(1024),
+ lock: &sync.RWMutex{},
+ subscribers: make([]func(remoting.EventType, []model.Instance), 0),
+ execOnce: &sync.Once{},
+ }
+ return watcher, nil
+}
+
+// AddSubscriber add subscriber into watcher's subscribers
+func (watcher *PolarisServiceWatcher) AddSubscriber(subscriber func(remoting.EventType, []model.Instance)) {
+
+ watcher.lazyRun()
+
+ watcher.lock.Lock()
+ defer watcher.lock.Unlock()
+
+ watcher.subscribers = append(watcher.subscribers, subscriber)
+}
+
+// lazyRun Delayed execution, only triggered when AddSubscriber is called, and will only be executed once
+func (watcher *PolarisServiceWatcher) lazyRun() {
+ watcher.execOnce.Do(func() {
+ go watcher.startWatcher()
+ go watcher.startDispatcher()
+ })
+}
+
+// startDispatcher dispatch polaris naming event
+func (watcher *PolarisServiceWatcher) startDispatcher() {
+ for {
+ select {
+ case val := <-watcher.events.Out():
+ event := val.(*config_center.ConfigChangeEvent)
+
+ func(event *config_center.ConfigChangeEvent) {
+
+ watcher.lock.RLock()
+ defer watcher.lock.RUnlock()
+
+ for i := 0; i < len(watcher.subscribers); i++ {
+ subscriber := watcher.subscribers[i]
+ subscriber(event.ConfigType, event.Value.([]model.Instance))
+ }
+
+ }(event)
+ }
+ }
+}
+
+// startWatcher start run work to watch target service by polaris
+func (watcher *PolarisServiceWatcher) startWatcher() {
+
+ for {
+ resp, err := watcher.consumer.WatchService(watcher.subscribeParam)
+ if err != nil {
+ time.Sleep(time.Duration(500 * time.Millisecond))
+ continue
+ }
+
+ watcher.events.In() <- &config_center.ConfigChangeEvent{
+ Value: resp.GetAllInstancesResp.Instances,
+ ConfigType: remoting.EventTypeAdd,
+ }
+
+ select {
+ case event := <-resp.EventChannel:
+ eType := event.GetSubScribeEventType()
+ if eType == api.EventInstance {
+ insEvent := event.(*model.InstanceEvent)
+ if insEvent.AddEvent != nil {
+ watcher.events.In() <- &config_center.ConfigChangeEvent{
+ Value: insEvent.AddEvent.Instances,
+ ConfigType: remoting.EventTypeAdd,
Review comment:
i'll fix
##########
File path: registry/polaris/core.go
##########
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//@Author: chuntaojun <li...@live.com>
+//@Description:
+//@Time: 2021/11/26 00:28
+
+package polaris
+
+import (
+ "sync"
+ "time"
+)
+
+import (
+ gxchan "github.com/dubbogo/gost/container/chan"
+
+ "github.com/polarismesh/polaris-go/api"
+ "github.com/polarismesh/polaris-go/pkg/model"
+)
+
+import (
+ "dubbo.apache.org/dubbo-go/v3/config_center"
+ "dubbo.apache.org/dubbo-go/v3/remoting"
+)
+
+// PolarisServiceWatcher
+type PolarisServiceWatcher struct {
+ consumer api.ConsumerAPI
+ subscribeParam *api.WatchServiceRequest
+ events *gxchan.UnboundedChan
+ lock *sync.RWMutex
+ subscribers []func(remoting.EventType, []model.Instance)
Review comment:
ok
--
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
[GitHub] [dubbo-go] LaurenceLiZhixin edited a comment on pull request #1620: [ISSUE #1601] polarismesh registry center
Posted by GitBox <gi...@apache.org>.
LaurenceLiZhixin edited a comment on pull request #1620:
URL: https://github.com/apache/dubbo-go/pull/1620#issuecomment-983246534
imports block的问题我更新了下,目前ci过了。
整体看没有什么大问题。希望在dubbo-go-samples/registry/polaris 给出对应的例子。 @chuntaojun
--
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
[GitHub] [dubbo-go] codecov-commenter edited a comment on pull request #1620: [ISSUE #1601] polarismesh registry center
Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #1620:
URL: https://github.com/apache/dubbo-go/pull/1620#issuecomment-983232595
# [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#1620](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (2ca8ae3) into [3.0](https://codecov.io/gh/apache/dubbo-go/commit/a6aa373d6dd62d1948ab990f38d1b8c24356034f?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (a6aa373) will **increase** coverage by `0.04%`.
> The diff coverage is `77.77%`.
> :exclamation: Current head 2ca8ae3 differs from pull request most recent head 4aa2aa1. Consider uploading reports for the commit 4aa2aa1 to get more accurate results
[](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## 3.0 #1620 +/- ##
==========================================
+ Coverage 40.93% 40.97% +0.04%
==========================================
Files 252 253 +1
Lines 14443 14496 +53
==========================================
+ Hits 5912 5940 +28
- Misses 7850 7868 +18
- Partials 681 688 +7
```
| [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [remoting/polaris/builder.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3RpbmcvcG9sYXJpcy9idWlsZGVyLmdv) | `77.77% <77.77%> (ø)` | |
| [filter/metrics/filter.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZmlsdGVyL21ldHJpY3MvZmlsdGVyLmdv) | `85.00% <0.00%> (-15.00%)` | :arrow_down: |
| [registry/nacos/listener.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvbmFjb3MvbGlzdGVuZXIuZ28=) | `77.96% <0.00%> (-2.04%)` | :arrow_down: |
| [registry/nacos/registry.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvbmFjb3MvcmVnaXN0cnkuZ28=) | `47.13% <0.00%> (-1.42%)` | :arrow_down: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [a6aa373...4aa2aa1](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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
[GitHub] [dubbo-go] AlexStocks commented on a change in pull request #1620: [ISSUE #1601] polarismesh registry center
Posted by GitBox <gi...@apache.org>.
AlexStocks commented on a change in pull request #1620:
URL: https://github.com/apache/dubbo-go/pull/1620#discussion_r760086230
##########
File path: registry/polaris/core.go
##########
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//@Author: chuntaojun <li...@live.com>
+//@Description:
+//@Time: 2021/11/26 00:28
+
+package polaris
+
+import (
+ "sync"
+ "time"
+)
+
+import (
+ gxchan "github.com/dubbogo/gost/container/chan"
+
+ "github.com/polarismesh/polaris-go/api"
+ "github.com/polarismesh/polaris-go/pkg/model"
+)
+
+import (
+ "dubbo.apache.org/dubbo-go/v3/config_center"
+ "dubbo.apache.org/dubbo-go/v3/remoting"
+)
+
+// PolarisServiceWatcher
+type PolarisServiceWatcher struct {
+ consumer api.ConsumerAPI
+ subscribeParam *api.WatchServiceRequest
+ events *gxchan.UnboundedChan
+ lock *sync.RWMutex
+ subscribers []func(remoting.EventType, []model.Instance)
Review comment:
对 `func(remoting.EventType, []model.Instance)` 通过 type 定义下类型,不要直接这样写
--
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
[GitHub] [dubbo-go] codecov-commenter edited a comment on pull request #1620: [ISSUE #1601] polarismesh registry center
Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #1620:
URL: https://github.com/apache/dubbo-go/pull/1620#issuecomment-983232595
# [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#1620](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (8a8e8c7) into [3.0](https://codecov.io/gh/apache/dubbo-go/commit/a6aa373d6dd62d1948ab990f38d1b8c24356034f?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (a6aa373) will **increase** coverage by `0.23%`.
> The diff coverage is `77.77%`.
[](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## 3.0 #1620 +/- ##
==========================================
+ Coverage 40.93% 41.16% +0.23%
==========================================
Files 252 253 +1
Lines 14443 14496 +53
==========================================
+ Hits 5912 5968 +56
+ Misses 7850 7836 -14
- Partials 681 692 +11
```
| [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [remoting/polaris/builder.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3RpbmcvcG9sYXJpcy9idWlsZGVyLmdv) | `77.77% <77.77%> (ø)` | |
| [filter/metrics/filter.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZmlsdGVyL21ldHJpY3MvZmlsdGVyLmdv) | `85.00% <0.00%> (-15.00%)` | :arrow_down: |
| [registry/nacos/listener.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvbmFjb3MvbGlzdGVuZXIuZ28=) | `77.96% <0.00%> (-2.04%)` | :arrow_down: |
| [registry/nacos/registry.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvbmFjb3MvcmVnaXN0cnkuZ28=) | `47.13% <0.00%> (-1.42%)` | :arrow_down: |
| [metrics/prometheus/reporter.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bWV0cmljcy9wcm9tZXRoZXVzL3JlcG9ydGVyLmdv) | `28.57% <0.00%> (+1.71%)` | :arrow_up: |
| [metadata/report/delegate/delegate\_report.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bWV0YWRhdGEvcmVwb3J0L2RlbGVnYXRlL2RlbGVnYXRlX3JlcG9ydC5nbw==) | `35.09% <0.00%> (+8.60%)` | :arrow_up: |
| [cluster/cluster/base/cluster\_invoker.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y2x1c3Rlci9jbHVzdGVyL2Jhc2UvY2x1c3Rlcl9pbnZva2VyLmdv) | `37.36% <0.00%> (+13.18%)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [a6aa373...8a8e8c7](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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
[GitHub] [dubbo-go] sanxun0325 commented on a change in pull request #1620: [ISSUE #1601] polarismesh registry center
Posted by GitBox <gi...@apache.org>.
sanxun0325 commented on a change in pull request #1620:
URL: https://github.com/apache/dubbo-go/pull/1620#discussion_r758143504
##########
File path: registry/polaris/core.go
##########
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//@Author: chuntaojun <li...@live.com>
+//@Description:
+//@Time: 2021/11/26 00:28
+
+package polaris
+
+import (
+ "sync"
+ "sync/atomic"
+ "time"
+)
+
+import (
+ gxchan "github.com/dubbogo/gost/container/chan"
+
+ "github.com/polarismesh/polaris-go/api"
+ "github.com/polarismesh/polaris-go/pkg/model"
+)
+
+import (
+ "dubbo.apache.org/dubbo-go/v3/config_center"
+ "dubbo.apache.org/dubbo-go/v3/remoting"
+)
+
+// PolarisServiceWatcher
+type PolarisServiceWatcher struct {
+ consumer api.ConsumerAPI
+ subscribeParam *api.WatchServiceRequest
+ events *gxchan.UnboundedChan
+ lock *sync.RWMutex
+ subscribers []func(remoting.EventType, []model.Instance)
+ isRun int32
Review comment:
uint8 type is better
##########
File path: registry/polaris/registry.go
##########
@@ -0,0 +1,326 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//@Author: chuntaojun <li...@live.com>
+//@Description:
+//@Time: 2021/11/19 02:46
+
+package polaris
+
+import (
+ "context"
+ "strconv"
+ "sync"
+ "time"
+)
+
+import (
+ perrors "github.com/pkg/errors"
+
+ "github.com/polarismesh/polaris-go/api"
+ "github.com/polarismesh/polaris-go/pkg/model"
+)
+
+import (
+ "dubbo.apache.org/dubbo-go/v3/common"
+ "dubbo.apache.org/dubbo-go/v3/common/constant"
+ "dubbo.apache.org/dubbo-go/v3/common/extension"
+ "dubbo.apache.org/dubbo-go/v3/common/logger"
+ "dubbo.apache.org/dubbo-go/v3/config_center"
+ "dubbo.apache.org/dubbo-go/v3/registry"
+ "dubbo.apache.org/dubbo-go/v3/remoting"
+ "dubbo.apache.org/dubbo-go/v3/remoting/polaris"
+)
+
+var localIP = ""
+
+const (
+ // RegistryConnDelay registry connection delay
+ RegistryConnDelay = 3
+)
+
+func init() {
+ localIP = common.GetLocalIp()
+ extension.SetRegistry(constant.PolarisKey, newPolarisRegistry)
+}
+
+// newPolarisRegistry will create new instance
+func newPolarisRegistry(url *common.URL) (registry.Registry, error) {
+ sdkCtx, _, err := polaris.GetPolarisConfig(url)
+ if err != nil {
+ return &polarisRegistry{}, err
+ }
+ pRegistry := &polarisRegistry{
+ consumer: api.NewConsumerAPIByContext(sdkCtx),
+ provider: api.NewProviderAPIByContext(sdkCtx),
+ lock: &sync.RWMutex{},
+ registryUrls: make(map[string]*PolarisHeartbeat),
+ listenerLock: &sync.RWMutex{},
+ watchers: make(map[string]*PolarisServiceWatcher),
+ }
+
+ return pRegistry, nil
+}
+
+type polarisRegistry struct {
+ url *common.URL
+ consumer api.ConsumerAPI
+ provider api.ProviderAPI
+ lock *sync.RWMutex
+ registryUrls map[string]*PolarisHeartbeat
+
+ listenerLock *sync.RWMutex
+ watchers map[string]*PolarisServiceWatcher
+}
+
+// Register
+func (pr *polarisRegistry) Register(url *common.URL) error {
+ serviceName := getServiceName(url)
+ param := createRegisterParam(url, serviceName)
+ resp, err := pr.provider.Register(param)
+ if err != nil {
+ return err
+ }
+
+ if resp.Existed {
+ logger.Warnf("instance already regist, namespace:%+v, service:%+v, host:%+v, port:%+v",
+ param.Namespace, param.Service, param.Host, param.Port)
+ }
+
+ pr.lock.Lock()
+ defer pr.lock.Unlock()
+
+ url.SetParam(constant.PolarisInstanceID, resp.InstanceID)
+
+ ctx, cancel := context.WithCancel(context.Background())
+ go pr.doHeartbeat(ctx, param)
+
+ pr.registryUrls[url.Key()] = &PolarisHeartbeat{
+ url: url,
+ cancel: cancel,
+ }
+ return nil
+}
+
+// UnRegister
+func (pr *polarisRegistry) UnRegister(conf *common.URL) error {
+ var (
+ ok bool
+ err error
+ oldVal *PolarisHeartbeat
+ )
+
+ func() {
+ pr.lock.Lock()
+ defer pr.lock.Unlock()
+
+ oldVal, ok = pr.registryUrls[conf.Key()]
+
+ if !ok {
+ err = perrors.Errorf("Path{%s} has not registered", conf.Key())
+ }
+
+ oldVal.cancel()
+ delete(pr.registryUrls, oldVal.url.Key())
+ }()
+
+ if err != nil {
+ return err
+ }
+
+ request := createDeregisterParam(conf, getServiceName(conf))
+
+ err = pr.provider.Deregister(request)
+ if err != nil {
+ func() {
+ pr.lock.Lock()
+ defer pr.lock.Unlock()
+ pr.registryUrls[conf.Key()] = oldVal
+ }()
+ return perrors.WithMessagef(err, "register(conf:%+v)", conf)
+ }
+ return nil
+}
+
+// Subscribe
+func (pr *polarisRegistry) Subscribe(url *common.URL, notifyListener registry.NotifyListener) error {
+ role, _ := strconv.Atoi(url.GetParam(constant.RegistryRoleKey, ""))
+ if role != common.CONSUMER {
+ return nil
+ }
+
+ watcher, err := pr.createPolarisWatcherIfAbsent(url)
+
+ if err != nil {
+ return err
+ }
+
+ for {
+ listener, err := NewPolarisListener(url)
+ if err != nil {
+ logger.Warnf("getListener() = err:%v", perrors.WithStack(err))
+ time.Sleep(time.Duration(RegistryConnDelay) * time.Second)
Review comment:
It might be better to use time.after
##########
File path: remoting/polaris/builder.go
##########
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//@Author: chuntaojun <li...@live.com>
+//@Description:
+//@Time: 2021/11/19 02:56
+
+package polaris
+
+import (
+ "errors"
+ "fmt"
+ "net"
+ "strconv"
+ "strings"
+)
+
+import (
+ perrors "github.com/pkg/errors"
+
+ "github.com/polarismesh/polaris-go/api"
+ "github.com/polarismesh/polaris-go/pkg/config"
+ "github.com/polarismesh/polaris-go/pkg/model"
+)
+
+import (
+ "dubbo.apache.org/dubbo-go/v3/common"
+ "dubbo.apache.org/dubbo-go/v3/common/constant"
+)
+
+const polarisClientName = "polaris-client"
Review comment:
definition in common/constant/key.go might be better
##########
File path: registry/polaris/registry.go
##########
@@ -0,0 +1,326 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//@Author: chuntaojun <li...@live.com>
+//@Description:
+//@Time: 2021/11/19 02:46
+
+package polaris
+
+import (
+ "context"
+ "strconv"
+ "sync"
+ "time"
+)
+
+import (
+ perrors "github.com/pkg/errors"
+
+ "github.com/polarismesh/polaris-go/api"
+ "github.com/polarismesh/polaris-go/pkg/model"
+)
+
+import (
+ "dubbo.apache.org/dubbo-go/v3/common"
+ "dubbo.apache.org/dubbo-go/v3/common/constant"
+ "dubbo.apache.org/dubbo-go/v3/common/extension"
+ "dubbo.apache.org/dubbo-go/v3/common/logger"
+ "dubbo.apache.org/dubbo-go/v3/config_center"
+ "dubbo.apache.org/dubbo-go/v3/registry"
+ "dubbo.apache.org/dubbo-go/v3/remoting"
+ "dubbo.apache.org/dubbo-go/v3/remoting/polaris"
+)
+
+var localIP = ""
+
+const (
+ // RegistryConnDelay registry connection delay
+ RegistryConnDelay = 3
+)
+
+func init() {
+ localIP = common.GetLocalIp()
+ extension.SetRegistry(constant.PolarisKey, newPolarisRegistry)
+}
+
+// newPolarisRegistry will create new instance
+func newPolarisRegistry(url *common.URL) (registry.Registry, error) {
+ sdkCtx, _, err := polaris.GetPolarisConfig(url)
+ if err != nil {
+ return &polarisRegistry{}, err
+ }
+ pRegistry := &polarisRegistry{
+ consumer: api.NewConsumerAPIByContext(sdkCtx),
+ provider: api.NewProviderAPIByContext(sdkCtx),
+ lock: &sync.RWMutex{},
+ registryUrls: make(map[string]*PolarisHeartbeat),
+ listenerLock: &sync.RWMutex{},
+ watchers: make(map[string]*PolarisServiceWatcher),
+ }
+
+ return pRegistry, nil
+}
+
+type polarisRegistry struct {
+ url *common.URL
+ consumer api.ConsumerAPI
+ provider api.ProviderAPI
+ lock *sync.RWMutex
+ registryUrls map[string]*PolarisHeartbeat
+
+ listenerLock *sync.RWMutex
+ watchers map[string]*PolarisServiceWatcher
+}
+
+// Register
+func (pr *polarisRegistry) Register(url *common.URL) error {
+ serviceName := getServiceName(url)
+ param := createRegisterParam(url, serviceName)
+ resp, err := pr.provider.Register(param)
+ if err != nil {
+ return err
+ }
+
+ if resp.Existed {
+ logger.Warnf("instance already regist, namespace:%+v, service:%+v, host:%+v, port:%+v",
+ param.Namespace, param.Service, param.Host, param.Port)
+ }
+
+ pr.lock.Lock()
+ defer pr.lock.Unlock()
+
+ url.SetParam(constant.PolarisInstanceID, resp.InstanceID)
+
+ ctx, cancel := context.WithCancel(context.Background())
+ go pr.doHeartbeat(ctx, param)
+
+ pr.registryUrls[url.Key()] = &PolarisHeartbeat{
+ url: url,
+ cancel: cancel,
+ }
+ return nil
+}
+
+// UnRegister
+func (pr *polarisRegistry) UnRegister(conf *common.URL) error {
+ var (
+ ok bool
+ err error
+ oldVal *PolarisHeartbeat
+ )
+
+ func() {
+ pr.lock.Lock()
+ defer pr.lock.Unlock()
+
+ oldVal, ok = pr.registryUrls[conf.Key()]
+
+ if !ok {
+ err = perrors.Errorf("Path{%s} has not registered", conf.Key())
+ }
+
+ oldVal.cancel()
+ delete(pr.registryUrls, oldVal.url.Key())
+ }()
+
+ if err != nil {
+ return err
+ }
+
+ request := createDeregisterParam(conf, getServiceName(conf))
+
+ err = pr.provider.Deregister(request)
+ if err != nil {
+ func() {
+ pr.lock.Lock()
+ defer pr.lock.Unlock()
+ pr.registryUrls[conf.Key()] = oldVal
+ }()
+ return perrors.WithMessagef(err, "register(conf:%+v)", conf)
+ }
+ return nil
+}
+
+// Subscribe
+func (pr *polarisRegistry) Subscribe(url *common.URL, notifyListener registry.NotifyListener) error {
+ role, _ := strconv.Atoi(url.GetParam(constant.RegistryRoleKey, ""))
+ if role != common.CONSUMER {
+ return nil
+ }
+
+ watcher, err := pr.createPolarisWatcherIfAbsent(url)
+
+ if err != nil {
+ return err
+ }
+
+ for {
+ listener, err := NewPolarisListener(url)
+ if err != nil {
+ logger.Warnf("getListener() = err:%v", perrors.WithStack(err))
+ time.Sleep(time.Duration(RegistryConnDelay) * time.Second)
+ continue
+ }
+
+ watcher.AddSubscriber(func(et remoting.EventType, instances []model.Instance) {
+ for i := range instances {
+ instance := instances[i]
+ listener.events.In() <- &config_center.ConfigChangeEvent{ConfigType: et, Value: instance}
+ }
+ })
+
+ for {
+ serviceEvent, err := listener.Next()
+ if err != nil {
+ logger.Warnf("Selector.watch() = error{%v}", perrors.WithStack(err))
+ listener.Close()
+ return err
+ }
+ logger.Infof("update begin, service event: %v", serviceEvent.String())
+ notifyListener.Notify(serviceEvent)
+ }
+ }
+}
+
+func (pr *polarisRegistry) createPolarisWatcherIfAbsent(url *common.URL) (*PolarisServiceWatcher, error) {
+
+ pr.listenerLock.Lock()
+ defer pr.listenerLock.Unlock()
+
+ serviceName := getSubscribeName(url)
+
+ if _, exist := pr.watchers[serviceName]; !exist {
+ subscribeParam := &api.WatchServiceRequest{
+ WatchServiceRequest: model.WatchServiceRequest{
+ Key: model.ServiceKey{
+ Namespace: url.GetParam(constant.PolarisNamespace, constant.PolarisDefaultNamespace),
+ Service: serviceName,
+ },
+ },
+ }
+
+ watcher, err := newPolarisWatcher(subscribeParam, pr.consumer)
+ if err != nil {
+ return nil, err
+ }
+ pr.watchers[serviceName] = watcher
+ }
+
+ return pr.watchers[serviceName], nil
+}
+
+// UnSubscribe
+func (pr *polarisRegistry) UnSubscribe(url *common.URL, notifyListener registry.NotifyListener) error {
+ // TODO wait polaris support it
+ return perrors.New("UnSubscribe not support in polarisRegistry")
+}
+
+// GetURL
+func (pr *polarisRegistry) GetURL() *common.URL {
+ return pr.url
+}
+
+// Destroy
+func (pr *polarisRegistry) Destroy() {
+ for _, val := range pr.registryUrls {
+ val.cancel()
+ err := pr.UnRegister(val.url)
+ logger.Infof("DeRegister Polaris URL:%+v", val.url)
+ if err != nil {
+ logger.Errorf("Deregister URL:%+v err:%v", val.url, err.Error())
+ }
+ }
+ return
+}
+
+// IsAvailable always return true when use polaris
+func (pr *polarisRegistry) IsAvailable() bool {
+ return true
+}
+
+// doHeartbeat Since polaris does not support automatic reporting of instance heartbeats, separate logic is
+// needed to implement it
+func (pr *polarisRegistry) doHeartbeat(ctx context.Context, ins *api.InstanceRegisterRequest) {
+ ticker := time.NewTicker(time.Duration(4) * time.Second)
+
+ heartbeat := &api.InstanceHeartbeatRequest{
+ InstanceHeartbeatRequest: model.InstanceHeartbeatRequest{
+ Service: ins.Service,
+ Namespace: ins.Namespace,
+ Host: ins.Host,
+ Port: ins.Port,
+ },
+ }
+
+ for {
+ select {
+ case <-ctx.Done():
+ return
+ case <-ticker.C:
+ pr.provider.Heartbeat(heartbeat)
+ }
+ }
+}
+
+// createRegisterParam convert dubbo url to polaris instance register request
+func createRegisterParam(url *common.URL, serviceName string) *api.InstanceRegisterRequest {
+ if len(url.Ip) == 0 {
+ url.Ip = localIP
+ }
+ if len(url.Port) == 0 || url.Port == "0" {
+ url.Port = "80"
+ }
+ port, _ := strconv.Atoi(url.Port)
+
+ metadata := make(map[string]string)
Review comment:
Set metadata initial capacity len(url.getParams)
##########
File path: registry/polaris/registry.go
##########
@@ -0,0 +1,326 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//@Author: chuntaojun <li...@live.com>
+//@Description:
+//@Time: 2021/11/19 02:46
+
+package polaris
+
+import (
+ "context"
+ "strconv"
+ "sync"
+ "time"
+)
+
+import (
+ perrors "github.com/pkg/errors"
+
+ "github.com/polarismesh/polaris-go/api"
+ "github.com/polarismesh/polaris-go/pkg/model"
+)
+
+import (
+ "dubbo.apache.org/dubbo-go/v3/common"
+ "dubbo.apache.org/dubbo-go/v3/common/constant"
+ "dubbo.apache.org/dubbo-go/v3/common/extension"
+ "dubbo.apache.org/dubbo-go/v3/common/logger"
+ "dubbo.apache.org/dubbo-go/v3/config_center"
+ "dubbo.apache.org/dubbo-go/v3/registry"
+ "dubbo.apache.org/dubbo-go/v3/remoting"
+ "dubbo.apache.org/dubbo-go/v3/remoting/polaris"
+)
+
+var localIP = ""
+
+const (
+ // RegistryConnDelay registry connection delay
+ RegistryConnDelay = 3
+)
+
+func init() {
+ localIP = common.GetLocalIp()
+ extension.SetRegistry(constant.PolarisKey, newPolarisRegistry)
+}
+
+// newPolarisRegistry will create new instance
+func newPolarisRegistry(url *common.URL) (registry.Registry, error) {
+ sdkCtx, _, err := polaris.GetPolarisConfig(url)
+ if err != nil {
+ return &polarisRegistry{}, err
+ }
+ pRegistry := &polarisRegistry{
+ consumer: api.NewConsumerAPIByContext(sdkCtx),
+ provider: api.NewProviderAPIByContext(sdkCtx),
+ lock: &sync.RWMutex{},
+ registryUrls: make(map[string]*PolarisHeartbeat),
+ listenerLock: &sync.RWMutex{},
+ watchers: make(map[string]*PolarisServiceWatcher),
+ }
+
+ return pRegistry, nil
+}
+
+type polarisRegistry struct {
+ url *common.URL
+ consumer api.ConsumerAPI
+ provider api.ProviderAPI
+ lock *sync.RWMutex
+ registryUrls map[string]*PolarisHeartbeat
+
+ listenerLock *sync.RWMutex
+ watchers map[string]*PolarisServiceWatcher
+}
+
+// Register
+func (pr *polarisRegistry) Register(url *common.URL) error {
+ serviceName := getServiceName(url)
+ param := createRegisterParam(url, serviceName)
+ resp, err := pr.provider.Register(param)
+ if err != nil {
+ return err
+ }
+
+ if resp.Existed {
+ logger.Warnf("instance already regist, namespace:%+v, service:%+v, host:%+v, port:%+v",
+ param.Namespace, param.Service, param.Host, param.Port)
+ }
+
+ pr.lock.Lock()
+ defer pr.lock.Unlock()
+
+ url.SetParam(constant.PolarisInstanceID, resp.InstanceID)
+
+ ctx, cancel := context.WithCancel(context.Background())
+ go pr.doHeartbeat(ctx, param)
+
+ pr.registryUrls[url.Key()] = &PolarisHeartbeat{
+ url: url,
+ cancel: cancel,
+ }
+ return nil
+}
+
+// UnRegister
+func (pr *polarisRegistry) UnRegister(conf *common.URL) error {
+ var (
+ ok bool
+ err error
+ oldVal *PolarisHeartbeat
+ )
+
+ func() {
+ pr.lock.Lock()
+ defer pr.lock.Unlock()
+
+ oldVal, ok = pr.registryUrls[conf.Key()]
+
+ if !ok {
+ err = perrors.Errorf("Path{%s} has not registered", conf.Key())
+ }
+
+ oldVal.cancel()
Review comment:
oldVal equals nil causes panic
--
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
[GitHub] [dubbo-go] codecov-commenter edited a comment on pull request #1620: [ISSUE #1601] polarismesh registry center
Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #1620:
URL: https://github.com/apache/dubbo-go/pull/1620#issuecomment-983232595
# [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#1620](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (6b339f8) into [3.0](https://codecov.io/gh/apache/dubbo-go/commit/a6aa373d6dd62d1948ab990f38d1b8c24356034f?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (a6aa373) will **increase** coverage by `0.14%`.
> The diff coverage is `77.77%`.
> :exclamation: Current head 6b339f8 differs from pull request most recent head 2ca8ae3. Consider uploading reports for the commit 2ca8ae3 to get more accurate results
[](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## 3.0 #1620 +/- ##
==========================================
+ Coverage 40.93% 41.08% +0.14%
==========================================
Files 252 253 +1
Lines 14443 14496 +53
==========================================
+ Hits 5912 5955 +43
- Misses 7850 7853 +3
- Partials 681 688 +7
```
| [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [remoting/polaris/builder.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3RpbmcvcG9sYXJpcy9idWlsZGVyLmdv) | `77.77% <77.77%> (ø)` | |
| [registry/nacos/listener.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvbmFjb3MvbGlzdGVuZXIuZ28=) | `77.96% <0.00%> (-2.04%)` | :arrow_down: |
| [registry/nacos/registry.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvbmFjb3MvcmVnaXN0cnkuZ28=) | `47.13% <0.00%> (-1.42%)` | :arrow_down: |
| [metadata/report/delegate/delegate\_report.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bWV0YWRhdGEvcmVwb3J0L2RlbGVnYXRlL2RlbGVnYXRlX3JlcG9ydC5nbw==) | `34.43% <0.00%> (+7.94%)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [a6aa373...2ca8ae3](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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
[GitHub] [dubbo-go] codecov-commenter edited a comment on pull request #1620: [ISSUE #1601] polarismesh registry center
Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #1620:
URL: https://github.com/apache/dubbo-go/pull/1620#issuecomment-983232595
# [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#1620](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (2ca8ae3) into [3.0](https://codecov.io/gh/apache/dubbo-go/commit/a6aa373d6dd62d1948ab990f38d1b8c24356034f?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (a6aa373) will **increase** coverage by `0.04%`.
> The diff coverage is `77.77%`.
> :exclamation: Current head 2ca8ae3 differs from pull request most recent head ba2cc45. Consider uploading reports for the commit ba2cc45 to get more accurate results
[](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## 3.0 #1620 +/- ##
==========================================
+ Coverage 40.93% 40.97% +0.04%
==========================================
Files 252 253 +1
Lines 14443 14496 +53
==========================================
+ Hits 5912 5940 +28
- Misses 7850 7868 +18
- Partials 681 688 +7
```
| [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [remoting/polaris/builder.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3RpbmcvcG9sYXJpcy9idWlsZGVyLmdv) | `77.77% <77.77%> (ø)` | |
| [filter/metrics/filter.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZmlsdGVyL21ldHJpY3MvZmlsdGVyLmdv) | `85.00% <0.00%> (-15.00%)` | :arrow_down: |
| [registry/nacos/listener.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvbmFjb3MvbGlzdGVuZXIuZ28=) | `77.96% <0.00%> (-2.04%)` | :arrow_down: |
| [registry/nacos/registry.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvbmFjb3MvcmVnaXN0cnkuZ28=) | `47.13% <0.00%> (-1.42%)` | :arrow_down: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [a6aa373...ba2cc45](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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
[GitHub] [dubbo-go] LaurenceLiZhixin edited a comment on pull request #1620: [ISSUE #1601] polarismesh registry center
Posted by GitBox <gi...@apache.org>.
LaurenceLiZhixin edited a comment on pull request #1620:
URL: https://github.com/apache/dubbo-go/pull/1620#issuecomment-981303651
You can add a samples here: https://github.com/apache/dubbo-go-samples/tree/master/registry
@chuntaojun
--
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
[GitHub] [dubbo-go] codecov-commenter edited a comment on pull request #1620: [ISSUE #1601] polarismesh registry center
Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #1620:
URL: https://github.com/apache/dubbo-go/pull/1620#issuecomment-983232595
# [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#1620](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (9bf0356) into [3.0](https://codecov.io/gh/apache/dubbo-go/commit/a6aa373d6dd62d1948ab990f38d1b8c24356034f?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (a6aa373) will **increase** coverage by `0.18%`.
> The diff coverage is `77.77%`.
> :exclamation: Current head 9bf0356 differs from pull request most recent head 6b339f8. Consider uploading reports for the commit 6b339f8 to get more accurate results
[](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## 3.0 #1620 +/- ##
==========================================
+ Coverage 40.93% 41.11% +0.18%
==========================================
Files 252 253 +1
Lines 14443 14479 +36
==========================================
+ Hits 5912 5953 +41
+ Misses 7850 7838 -12
- Partials 681 688 +7
```
| [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [remoting/polaris/builder.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3RpbmcvcG9sYXJpcy9idWlsZGVyLmdv) | `77.77% <77.77%> (ø)` | |
| [filter/metrics/filter.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZmlsdGVyL21ldHJpY3MvZmlsdGVyLmdv) | `85.00% <0.00%> (-15.00%)` | :arrow_down: |
| [metrics/prometheus/reporter.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bWV0cmljcy9wcm9tZXRoZXVzL3JlcG9ydGVyLmdv) | `28.57% <0.00%> (+1.71%)` | :arrow_up: |
| [metadata/report/delegate/delegate\_report.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bWV0YWRhdGEvcmVwb3J0L2RlbGVnYXRlL2RlbGVnYXRlX3JlcG9ydC5nbw==) | `35.09% <0.00%> (+8.60%)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [a6aa373...6b339f8](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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
[GitHub] [dubbo-go] codecov-commenter edited a comment on pull request #1620: [ISSUE #1601] polarismesh registry center
Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #1620:
URL: https://github.com/apache/dubbo-go/pull/1620#issuecomment-983232595
# [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#1620](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (2ca8ae3) into [3.0](https://codecov.io/gh/apache/dubbo-go/commit/a6aa373d6dd62d1948ab990f38d1b8c24356034f?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (a6aa373) will **increase** coverage by `0.04%`.
> The diff coverage is `77.77%`.
[](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## 3.0 #1620 +/- ##
==========================================
+ Coverage 40.93% 40.97% +0.04%
==========================================
Files 252 253 +1
Lines 14443 14496 +53
==========================================
+ Hits 5912 5940 +28
- Misses 7850 7868 +18
- Partials 681 688 +7
```
| [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [remoting/polaris/builder.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3RpbmcvcG9sYXJpcy9idWlsZGVyLmdv) | `77.77% <77.77%> (ø)` | |
| [filter/metrics/filter.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZmlsdGVyL21ldHJpY3MvZmlsdGVyLmdv) | `85.00% <0.00%> (-15.00%)` | :arrow_down: |
| [registry/nacos/listener.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvbmFjb3MvbGlzdGVuZXIuZ28=) | `77.96% <0.00%> (-2.04%)` | :arrow_down: |
| [registry/nacos/registry.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvbmFjb3MvcmVnaXN0cnkuZ28=) | `47.13% <0.00%> (-1.42%)` | :arrow_down: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [a6aa373...2ca8ae3](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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
[GitHub] [dubbo-go] codecov-commenter edited a comment on pull request #1620: [ISSUE #1601] polarismesh registry center
Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #1620:
URL: https://github.com/apache/dubbo-go/pull/1620#issuecomment-983232595
# [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#1620](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (6b339f8) into [3.0](https://codecov.io/gh/apache/dubbo-go/commit/a6aa373d6dd62d1948ab990f38d1b8c24356034f?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (a6aa373) will **increase** coverage by `0.14%`.
> The diff coverage is `77.77%`.
[](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## 3.0 #1620 +/- ##
==========================================
+ Coverage 40.93% 41.08% +0.14%
==========================================
Files 252 253 +1
Lines 14443 14496 +53
==========================================
+ Hits 5912 5955 +43
- Misses 7850 7853 +3
- Partials 681 688 +7
```
| [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [remoting/polaris/builder.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3RpbmcvcG9sYXJpcy9idWlsZGVyLmdv) | `77.77% <77.77%> (ø)` | |
| [registry/nacos/listener.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvbmFjb3MvbGlzdGVuZXIuZ28=) | `77.96% <0.00%> (-2.04%)` | :arrow_down: |
| [registry/nacos/registry.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvbmFjb3MvcmVnaXN0cnkuZ28=) | `47.13% <0.00%> (-1.42%)` | :arrow_down: |
| [metadata/report/delegate/delegate\_report.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bWV0YWRhdGEvcmVwb3J0L2RlbGVnYXRlL2RlbGVnYXRlX3JlcG9ydC5nbw==) | `34.43% <0.00%> (+7.94%)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [a6aa373...6b339f8](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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
[GitHub] [dubbo-go] Mulavar commented on a change in pull request #1620: [ISSUE #1601] polarismesh registry center
Posted by GitBox <gi...@apache.org>.
Mulavar commented on a change in pull request #1620:
URL: https://github.com/apache/dubbo-go/pull/1620#discussion_r760029127
##########
File path: registry/polaris/core.go
##########
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//@Author: chuntaojun <li...@live.com>
+//@Description:
+//@Time: 2021/11/26 00:28
+
+package polaris
+
+import (
+ "sync"
+ "time"
+)
+
+import (
+ gxchan "github.com/dubbogo/gost/container/chan"
+
+ "github.com/polarismesh/polaris-go/api"
+ "github.com/polarismesh/polaris-go/pkg/model"
+)
+
+import (
+ "dubbo.apache.org/dubbo-go/v3/config_center"
+ "dubbo.apache.org/dubbo-go/v3/remoting"
+)
+
+// PolarisServiceWatcher
+type PolarisServiceWatcher struct {
+ consumer api.ConsumerAPI
+ subscribeParam *api.WatchServiceRequest
+ events *gxchan.UnboundedChan
+ lock *sync.RWMutex
+ subscribers []func(remoting.EventType, []model.Instance)
+ execOnce *sync.Once
+}
+
+// newPolarisWatcher create PolarisServiceWatcher to do watch service action
+func newPolarisWatcher(param *api.WatchServiceRequest, consumer api.ConsumerAPI) (*PolarisServiceWatcher, error) {
+ watcher := &PolarisServiceWatcher{
+ subscribeParam: param,
+ consumer: consumer,
+ events: gxchan.NewUnboundedChan(1024),
+ lock: &sync.RWMutex{},
+ subscribers: make([]func(remoting.EventType, []model.Instance), 0),
+ execOnce: &sync.Once{},
+ }
+ return watcher, nil
+}
+
+// AddSubscriber add subscriber into watcher's subscribers
+func (watcher *PolarisServiceWatcher) AddSubscriber(subscriber func(remoting.EventType, []model.Instance)) {
+
+ watcher.lazyRun()
+
+ watcher.lock.Lock()
+ defer watcher.lock.Unlock()
+
+ watcher.subscribers = append(watcher.subscribers, subscriber)
+}
+
+// lazyRun Delayed execution, only triggered when AddSubscriber is called, and will only be executed once
+func (watcher *PolarisServiceWatcher) lazyRun() {
+ watcher.execOnce.Do(func() {
+ go watcher.startWatcher()
+ go watcher.startDispatcher()
+ })
+}
+
+// startDispatcher dispatch polaris naming event
+func (watcher *PolarisServiceWatcher) startDispatcher() {
+ for {
+ select {
+ case val := <-watcher.events.Out():
+ event := val.(*config_center.ConfigChangeEvent)
+
+ func(event *config_center.ConfigChangeEvent) {
+
+ watcher.lock.RLock()
+ defer watcher.lock.RUnlock()
+
+ for i := 0; i < len(watcher.subscribers); i++ {
+ subscriber := watcher.subscribers[i]
+ subscriber(event.ConfigType, event.Value.([]model.Instance))
+ }
+
+ }(event)
+ }
+ }
+}
+
+// startWatcher start run work to watch target service by polaris
+func (watcher *PolarisServiceWatcher) startWatcher() {
+
+ for {
+ resp, err := watcher.consumer.WatchService(watcher.subscribeParam)
+ if err != nil {
+ time.Sleep(time.Duration(500 * time.Millisecond))
+ continue
+ }
+
+ watcher.events.In() <- &config_center.ConfigChangeEvent{
+ Value: resp.GetAllInstancesResp.Instances,
+ ConfigType: remoting.EventTypeAdd,
+ }
+
+ select {
+ case event := <-resp.EventChannel:
+ eType := event.GetSubScribeEventType()
+ if eType == api.EventInstance {
+ insEvent := event.(*model.InstanceEvent)
+ if insEvent.AddEvent != nil {
+ watcher.events.In() <- &config_center.ConfigChangeEvent{
+ Value: insEvent.AddEvent.Instances,
+ ConfigType: remoting.EventTypeAdd,
Review comment:
加上115行,这地方需要放两次event嘛?
--
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
[GitHub] [dubbo-go] LaurenceLiZhixin commented on pull request #1620: [ISSUE #1601] polarismesh registry center
Posted by GitBox <gi...@apache.org>.
LaurenceLiZhixin commented on pull request #1620:
URL: https://github.com/apache/dubbo-go/pull/1620#issuecomment-981305921
You can install imports-formatter : https://github.com/dubbogo/tools#5-how-to-get-imports-formatter
and run `imports-formatter .` in your repo root path, to pass imports check. @chuntaojun
--
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
[GitHub] [dubbo-go] LaurenceLiZhixin commented on pull request #1620: [ISSUE #1601] polarismesh registry center
Posted by GitBox <gi...@apache.org>.
LaurenceLiZhixin commented on pull request #1620:
URL: https://github.com/apache/dubbo-go/pull/1620#issuecomment-983246534
imports block的问题我更新了下,目前ci过了。
--
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
[GitHub] [dubbo-go] chuntaojun commented on pull request #1620: [ISSUE #1601] polarismesh registry center
Posted by GitBox <gi...@apache.org>.
chuntaojun commented on pull request #1620:
URL: https://github.com/apache/dubbo-go/pull/1620#issuecomment-983252600
Okay, I will solve the problem raised in CR as soon as possible
--
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
[GitHub] [dubbo-go] codecov-commenter edited a comment on pull request #1620: [ISSUE #1601] polarismesh registry center
Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #1620:
URL: https://github.com/apache/dubbo-go/pull/1620#issuecomment-983232595
# [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#1620](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (9bf0356) into [3.0](https://codecov.io/gh/apache/dubbo-go/commit/a6aa373d6dd62d1948ab990f38d1b8c24356034f?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (a6aa373) will **increase** coverage by `0.18%`.
> The diff coverage is `77.77%`.
> :exclamation: Current head 9bf0356 differs from pull request most recent head 63f1864. Consider uploading reports for the commit 63f1864 to get more accurate results
[](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## 3.0 #1620 +/- ##
==========================================
+ Coverage 40.93% 41.11% +0.18%
==========================================
Files 252 253 +1
Lines 14443 14479 +36
==========================================
+ Hits 5912 5953 +41
+ Misses 7850 7838 -12
- Partials 681 688 +7
```
| [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [remoting/polaris/builder.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3RpbmcvcG9sYXJpcy9idWlsZGVyLmdv) | `77.77% <77.77%> (ø)` | |
| [filter/metrics/filter.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZmlsdGVyL21ldHJpY3MvZmlsdGVyLmdv) | `85.00% <0.00%> (-15.00%)` | :arrow_down: |
| [metrics/prometheus/reporter.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bWV0cmljcy9wcm9tZXRoZXVzL3JlcG9ydGVyLmdv) | `28.57% <0.00%> (+1.71%)` | :arrow_up: |
| [metadata/report/delegate/delegate\_report.go](https://codecov.io/gh/apache/dubbo-go/pull/1620/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bWV0YWRhdGEvcmVwb3J0L2RlbGVnYXRlL2RlbGVnYXRlX3JlcG9ydC5nbw==) | `35.09% <0.00%> (+8.60%)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [a6aa373...63f1864](https://codecov.io/gh/apache/dubbo-go/pull/1620?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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
[GitHub] [dubbo-go] AlexStocks merged pull request #1620: [ISSUE #1601] polarismesh registry center
Posted by GitBox <gi...@apache.org>.
AlexStocks merged pull request #1620:
URL: https://github.com/apache/dubbo-go/pull/1620
--
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