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/05/24 06:40:08 UTC

[GitHub] [dubbo-go] cvictory opened a new pull request #537: Add attribute method into Invocation and RpcInvocation

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


   Some parameter need to be used in the internal process.  For example we need calculate the serialize type and store into attribute. If we don't store it and this serialize value is used by some function or method , we must calculate it in every function.
   
   


----------------------------------------------------------------
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 #537: Add attribute method into Invocation and RpcInvocation

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



##########
File path: protocol/invocation/rpcinvocation.go
##########
@@ -142,6 +143,16 @@ func (r *RPCInvocation) SetAttachments(key string, value string) {
 	r.attachments[key] = value
 }
 
+// SetAttribute. If Attributes is nil, it will be inited.
+func (r *RPCInvocation) SetAttribute(key string, value interface{}) {
+	r.lock.Lock()
+	defer r.lock.Unlock()
+	if r.attributes == nil {

Review comment:
       NewRPCInvocationWithOptions 这个方法暂时管控不住。 增加了WithAttributes 的function.




----------------------------------------------------------------
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 #537: Add attribute method into Invocation and RpcInvocation

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



##########
File path: protocol/invocation/rpcinvocation.go
##########
@@ -40,8 +40,10 @@ type RPCInvocation struct {
 	reply           interface{}
 	callBack        interface{}
 	attachments     map[string]string
-	invoker         protocol.Invoker
-	lock            sync.RWMutex
+	// Refer to dubbo 2.7.6.  It is different from attachment. It is used in internal process.
+	attributes map[string]interface{}

Review comment:
       I have fix this issue in NewRPCInvocation function.




----------------------------------------------------------------
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 #537: Add attribute method into Invocation and RpcInvocation

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



##########
File path: protocol/invocation/rpcinvocation.go
##########
@@ -142,6 +143,16 @@ func (r *RPCInvocation) SetAttachments(key string, value string) {
 	r.attachments[key] = value
 }
 
+// SetAttribute. If Attributes is nil, it will be inited.
+func (r *RPCInvocation) SetAttribute(key string, value interface{}) {
+	r.lock.Lock()
+	defer r.lock.Unlock()
+	if r.attributes == nil {

Review comment:
       NewRPCInvocationWithOptions 这个方法暂时管控不住。




----------------------------------------------------------------
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] zouyx commented on a change in pull request #537: Add attribute method into Invocation and RpcInvocation

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



##########
File path: protocol/invocation/rpcinvocation.go
##########
@@ -111,6 +114,25 @@ func (r *RPCInvocation) AttachmentsByKey(key string, defaultValue string) string
 	return defaultValue
 }
 
+// get attributes
+func (r *RPCInvocation) Attributes() map[string]interface{} {
+	return r.attributes
+}
+
+// get attribute by key. If it is not exist, it will return default value
+func (r *RPCInvocation) AttributeByKey(key string, defaultValue interface{}) interface{} {
+	r.lock.RLock()
+	defer r.lock.RUnlock()
+	if r.attributes == nil {

Review comment:
       why don't use `len(r.attributes)==0`?




----------------------------------------------------------------
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 #537: Add attribute method into Invocation and RpcInvocation

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



##########
File path: protocol/invocation/rpcinvocation.go
##########
@@ -111,6 +113,25 @@ func (r *RPCInvocation) AttachmentsByKey(key string, defaultValue string) string
 	return defaultValue
 }
 
+// get attributes
+func (r *RPCInvocation) Attributes() map[string]interface{} {
+	return r.attributes
+}
+
+// get attribute by key. If it is not exist, it will return default value
+func (r *RPCInvocation) AttributeByKey(key string, defaultValue interface{}) interface{} {
+	r.lock.RLock()
+	defer r.lock.RUnlock()
+	if r.attributes == nil {

Review comment:
       There are two methods about NewRPCInvocation . Another one is NewRPCInvocationWithOptions.  We cannot make it init it well.




----------------------------------------------------------------
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 #537: Add attribute method into Invocation and RpcInvocation

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



##########
File path: protocol/invocation/rpcinvocation.go
##########
@@ -111,6 +113,25 @@ func (r *RPCInvocation) AttachmentsByKey(key string, defaultValue string) string
 	return defaultValue
 }
 
+// get attributes
+func (r *RPCInvocation) Attributes() map[string]interface{} {
+	return r.attributes
+}
+
+// get attribute by key. If it is not exist, it will return default value
+func (r *RPCInvocation) AttributeByKey(key string, defaultValue interface{}) interface{} {
+	r.lock.RLock()
+	defer r.lock.RUnlock()
+	if r.attributes == nil {

Review comment:
       @cvictory pls improve NewRPCInvocationWithOptions.




----------------------------------------------------------------
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-commenter commented on pull request #537: Add attribute method into Invocation and RpcInvocation

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


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/537?src=pr&el=h1) Report
   > Merging [#537](https://codecov.io/gh/apache/dubbo-go/pull/537?src=pr&el=desc) into [master](https://codecov.io/gh/apache/dubbo-go/commit/8a3c02c9b7737a12712451b16a3cdc8ce46a5c7d&el=desc) will **decrease** coverage by `0.28%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/537/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL)](https://codecov.io/gh/apache/dubbo-go/pull/537?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master     #537      +/-   ##
   ==========================================
   - Coverage   67.20%   66.92%   -0.29%     
   ==========================================
     Files         174      174              
     Lines        9261     9261              
   ==========================================
   - Hits         6224     6198      -26     
   - Misses       2432     2456      +24     
   - Partials      605      607       +2     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/537?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [protocol/dubbo/listener.go](https://codecov.io/gh/apache/dubbo-go/pull/537/diff?src=pr&el=tree#diff-cHJvdG9jb2wvZHViYm8vbGlzdGVuZXIuZ28=) | `57.52% <0.00%> (-5.38%)` | :arrow_down: |
   | [protocol/dubbo/codec.go](https://codecov.io/gh/apache/dubbo-go/pull/537/diff?src=pr&el=tree#diff-cHJvdG9jb2wvZHViYm8vY29kZWMuZ28=) | `72.50% <0.00%> (-5.00%)` | :arrow_down: |
   | [protocol/dubbo/pool.go](https://codecov.io/gh/apache/dubbo-go/pull/537/diff?src=pr&el=tree#diff-cHJvdG9jb2wvZHViYm8vcG9vbC5nbw==) | `76.71% <0.00%> (-4.57%)` | :arrow_down: |
   | [filter/filter\_impl/hystrix\_filter.go](https://codecov.io/gh/apache/dubbo-go/pull/537/diff?src=pr&el=tree#diff-ZmlsdGVyL2ZpbHRlcl9pbXBsL2h5c3RyaXhfZmlsdGVyLmdv) | `68.64% <0.00%> (-3.39%)` | :arrow_down: |
   | [protocol/dubbo/readwriter.go](https://codecov.io/gh/apache/dubbo-go/pull/537/diff?src=pr&el=tree#diff-cHJvdG9jb2wvZHViYm8vcmVhZHdyaXRlci5nbw==) | `68.29% <0.00%> (-2.44%)` | :arrow_down: |
   | [remoting/kubernetes/listener.go](https://codecov.io/gh/apache/dubbo-go/pull/537/diff?src=pr&el=tree#diff-cmVtb3Rpbmcva3ViZXJuZXRlcy9saXN0ZW5lci5nbw==) | `56.07% <0.00%> (ø)` | |
   | [protocol/dubbo/client.go](https://codecov.io/gh/apache/dubbo-go/pull/537/diff?src=pr&el=tree#diff-cHJvdG9jb2wvZHViYm8vY2xpZW50Lmdv) | `69.09% <0.00%> (+1.21%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/537?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/537?src=pr&el=footer). Last update [8a3c02c...5246e56](https://codecov.io/gh/apache/dubbo-go/pull/537?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] AlexStocks commented on a change in pull request #537: Add attribute method into Invocation and RpcInvocation

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



##########
File path: protocol/invocation/rpcinvocation.go
##########
@@ -111,6 +113,25 @@ func (r *RPCInvocation) AttachmentsByKey(key string, defaultValue string) string
 	return defaultValue
 }
 
+// get attributes
+func (r *RPCInvocation) Attributes() map[string]interface{} {
+	return r.attributes
+}
+
+// get attribute by key. If it is not exist, it will return default value
+func (r *RPCInvocation) AttributeByKey(key string, defaultValue interface{}) interface{} {
+	r.lock.RLock()
+	defer r.lock.RUnlock()
+	if r.attributes == nil {

Review comment:
       @flycash can not agree with u more.




----------------------------------------------------------------
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 #537: Add attribute method into Invocation and RpcInvocation

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



##########
File path: protocol/invocation/rpcinvocation.go
##########
@@ -111,6 +113,25 @@ func (r *RPCInvocation) AttachmentsByKey(key string, defaultValue string) string
 	return defaultValue
 }
 
+// get attributes
+func (r *RPCInvocation) Attributes() map[string]interface{} {
+	return r.attributes
+}
+
+// get attribute by key. If it is not exist, it will return default value
+func (r *RPCInvocation) AttributeByKey(key string, defaultValue interface{}) interface{} {
+	r.lock.RLock()
+	defer r.lock.RUnlock()
+	if r.attributes == nil {

Review comment:
       I have added WithAttributes function for 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 commented on a change in pull request #537: Add attribute method into Invocation and RpcInvocation

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



##########
File path: protocol/invocation/rpcinvocation.go
##########
@@ -142,6 +143,16 @@ func (r *RPCInvocation) SetAttachments(key string, value string) {
 	r.attachments[key] = value
 }
 
+// SetAttribute. If Attributes is nil, it will be inited.
+func (r *RPCInvocation) SetAttribute(key string, value interface{}) {
+	r.lock.Lock()
+	defer r.lock.Unlock()
+	if r.attributes == nil {

Review comment:
       suggest that u delete this if condition when u init r.attributes in newRPCInvocation.




----------------------------------------------------------------
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 #537: Add attribute method into Invocation and RpcInvocation

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


   


----------------------------------------------------------------
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 #537: Add attribute method into Invocation and RpcInvocation

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



##########
File path: protocol/invocation/rpcinvocation.go
##########
@@ -111,6 +113,25 @@ func (r *RPCInvocation) AttachmentsByKey(key string, defaultValue string) string
 	return defaultValue
 }
 
+// get attributes
+func (r *RPCInvocation) Attributes() map[string]interface{} {
+	return r.attributes
+}
+
+// get attribute by key. If it is not exist, it will return default value
+func (r *RPCInvocation) AttributeByKey(key string, defaultValue interface{}) interface{} {
+	r.lock.RLock()
+	defer r.lock.RUnlock()
+	if r.attributes == nil {

Review comment:
       @cvictory pls delete WithAttributes and modify NewRPCInvocationWithOptions




----------------------------------------------------------------
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] flycash commented on a change in pull request #537: Add attribute method into Invocation and RpcInvocation

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



##########
File path: protocol/invocation/rpcinvocation.go
##########
@@ -111,6 +113,25 @@ func (r *RPCInvocation) AttachmentsByKey(key string, defaultValue string) string
 	return defaultValue
 }
 
+// get attributes
+func (r *RPCInvocation) Attributes() map[string]interface{} {
+	return r.attributes
+}
+
+// get attribute by key. If it is not exist, it will return default value
+func (r *RPCInvocation) AttributeByKey(key string, defaultValue interface{}) interface{} {
+	r.lock.RLock()
+	defer r.lock.RUnlock()
+	if r.attributes == nil {

Review comment:
       I think we could init the attributes in NewRPCInvocationWithOptions too. The attribute map is empty. What's your concern?




----------------------------------------------------------------
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-commenter edited a comment on pull request #537: Add attribute method into Invocation and RpcInvocation

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


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/537?src=pr&el=h1) Report
   > Merging [#537](https://codecov.io/gh/apache/dubbo-go/pull/537?src=pr&el=desc) into [develop](https://codecov.io/gh/apache/dubbo-go/commit/8a3c02c9b7737a12712451b16a3cdc8ce46a5c7d&el=desc) will **decrease** coverage by `0.28%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/537/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL)](https://codecov.io/gh/apache/dubbo-go/pull/537?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           develop     #537      +/-   ##
   ===========================================
   - Coverage    67.20%   66.92%   -0.29%     
   ===========================================
     Files          174      174              
     Lines         9261     9261              
   ===========================================
   - Hits          6224     6198      -26     
   - Misses        2432     2456      +24     
   - Partials       605      607       +2     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/537?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [protocol/dubbo/listener.go](https://codecov.io/gh/apache/dubbo-go/pull/537/diff?src=pr&el=tree#diff-cHJvdG9jb2wvZHViYm8vbGlzdGVuZXIuZ28=) | `57.52% <0.00%> (-5.38%)` | :arrow_down: |
   | [protocol/dubbo/codec.go](https://codecov.io/gh/apache/dubbo-go/pull/537/diff?src=pr&el=tree#diff-cHJvdG9jb2wvZHViYm8vY29kZWMuZ28=) | `72.50% <0.00%> (-5.00%)` | :arrow_down: |
   | [protocol/dubbo/pool.go](https://codecov.io/gh/apache/dubbo-go/pull/537/diff?src=pr&el=tree#diff-cHJvdG9jb2wvZHViYm8vcG9vbC5nbw==) | `76.71% <0.00%> (-4.57%)` | :arrow_down: |
   | [filter/filter\_impl/hystrix\_filter.go](https://codecov.io/gh/apache/dubbo-go/pull/537/diff?src=pr&el=tree#diff-ZmlsdGVyL2ZpbHRlcl9pbXBsL2h5c3RyaXhfZmlsdGVyLmdv) | `68.64% <0.00%> (-3.39%)` | :arrow_down: |
   | [protocol/dubbo/readwriter.go](https://codecov.io/gh/apache/dubbo-go/pull/537/diff?src=pr&el=tree#diff-cHJvdG9jb2wvZHViYm8vcmVhZHdyaXRlci5nbw==) | `68.29% <0.00%> (-2.44%)` | :arrow_down: |
   | [remoting/kubernetes/listener.go](https://codecov.io/gh/apache/dubbo-go/pull/537/diff?src=pr&el=tree#diff-cmVtb3Rpbmcva3ViZXJuZXRlcy9saXN0ZW5lci5nbw==) | `56.07% <0.00%> (ø)` | |
   | [protocol/dubbo/client.go](https://codecov.io/gh/apache/dubbo-go/pull/537/diff?src=pr&el=tree#diff-cHJvdG9jb2wvZHViYm8vY2xpZW50Lmdv) | `69.09% <0.00%> (+1.21%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/537?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/537?src=pr&el=footer). Last update [8a3c02c...41c9d89](https://codecov.io/gh/apache/dubbo-go/pull/537?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] AlexStocks commented on a change in pull request #537: Add attribute method into Invocation and RpcInvocation

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



##########
File path: protocol/invocation/rpcinvocation.go
##########
@@ -40,8 +40,10 @@ type RPCInvocation struct {
 	reply           interface{}
 	callBack        interface{}
 	attachments     map[string]string
-	invoker         protocol.Invoker
-	lock            sync.RWMutex
+	// Refer to dubbo 2.7.6.  It is different from attachment. It is used in internal process.
+	attributes map[string]interface{}

Review comment:
       @cvictory pls remember that: when u define a map/slice/chan in a struct , u should init it by `make(map[string]interface{}, 8)` in NewRPCInvocation. If not, the program will panic when u visit or write this map.

##########
File path: protocol/invocation/rpcinvocation.go
##########
@@ -111,6 +113,25 @@ func (r *RPCInvocation) AttachmentsByKey(key string, defaultValue string) string
 	return defaultValue
 }
 
+// get attributes
+func (r *RPCInvocation) Attributes() map[string]interface{} {
+	return r.attributes
+}
+
+// get attribute by key. If it is not exist, it will return default value
+func (r *RPCInvocation) AttributeByKey(key string, defaultValue interface{}) interface{} {
+	r.lock.RLock()
+	defer r.lock.RUnlock()
+	if r.attributes == nil {

Review comment:
       after init this map in newRPCInvocation, u can delete this if condition clause.




----------------------------------------------------------------
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-commenter edited a comment on pull request #537: Add attribute method into Invocation and RpcInvocation

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


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/537?src=pr&el=h1) Report
   > Merging [#537](https://codecov.io/gh/apache/dubbo-go/pull/537?src=pr&el=desc) into [develop](https://codecov.io/gh/apache/dubbo-go/commit/8a3c02c9b7737a12712451b16a3cdc8ce46a5c7d&el=desc) will **decrease** coverage by `0.74%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/537/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL)](https://codecov.io/gh/apache/dubbo-go/pull/537?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           develop     #537      +/-   ##
   ===========================================
   - Coverage    67.20%   66.46%   -0.75%     
   ===========================================
     Files          174      184      +10     
     Lines         9261     9712     +451     
   ===========================================
   + Hits          6224     6455     +231     
   - Misses        2432     2617     +185     
   - Partials       605      640      +35     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/537?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [registry/zookeeper/registry.go](https://codecov.io/gh/apache/dubbo-go/pull/537/diff?src=pr&el=tree#diff-cmVnaXN0cnkvem9va2VlcGVyL3JlZ2lzdHJ5Lmdv) | `46.15% <0.00%> (-9.30%)` | :arrow_down: |
   | [protocol/dubbo/listener.go](https://codecov.io/gh/apache/dubbo-go/pull/537/diff?src=pr&el=tree#diff-cHJvdG9jb2wvZHViYm8vbGlzdGVuZXIuZ28=) | `57.52% <0.00%> (-5.38%)` | :arrow_down: |
   | [common/url.go](https://codecov.io/gh/apache/dubbo-go/pull/537/diff?src=pr&el=tree#diff-Y29tbW9uL3VybC5nbw==) | `65.83% <0.00%> (-5.33%)` | :arrow_down: |
   | [protocol/dubbo/pool.go](https://codecov.io/gh/apache/dubbo-go/pull/537/diff?src=pr&el=tree#diff-cHJvdG9jb2wvZHViYm8vcG9vbC5nbw==) | `76.81% <0.00%> (-4.47%)` | :arrow_down: |
   | [config\_center/nacos/impl.go](https://codecov.io/gh/apache/dubbo-go/pull/537/diff?src=pr&el=tree#diff-Y29uZmlnX2NlbnRlci9uYWNvcy9pbXBsLmdv) | `71.08% <0.00%> (-4.31%)` | :arrow_down: |
   | [config\_center/apollo/impl.go](https://codecov.io/gh/apache/dubbo-go/pull/537/diff?src=pr&el=tree#diff-Y29uZmlnX2NlbnRlci9hcG9sbG8vaW1wbC5nbw==) | `82.71% <0.00%> (-4.30%)` | :arrow_down: |
   | [remoting/zookeeper/facade.go](https://codecov.io/gh/apache/dubbo-go/pull/537/diff?src=pr&el=tree#diff-cmVtb3Rpbmcvem9va2VlcGVyL2ZhY2FkZS5nbw==) | `70.27% <0.00%> (-4.02%)` | :arrow_down: |
   | [config/provider\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/537/diff?src=pr&el=tree#diff-Y29uZmlnL3Byb3ZpZGVyX2NvbmZpZy5nbw==) | `55.88% <0.00%> (-3.50%)` | :arrow_down: |
   | [filter/filter\_impl/hystrix\_filter.go](https://codecov.io/gh/apache/dubbo-go/pull/537/diff?src=pr&el=tree#diff-ZmlsdGVyL2ZpbHRlcl9pbXBsL2h5c3RyaXhfZmlsdGVyLmdv) | `68.64% <0.00%> (-3.39%)` | :arrow_down: |
   | [registry/nacos/registry.go](https://codecov.io/gh/apache/dubbo-go/pull/537/diff?src=pr&el=tree#diff-cmVnaXN0cnkvbmFjb3MvcmVnaXN0cnkuZ28=) | `58.42% <0.00%> (-3.37%)` | :arrow_down: |
   | ... and [64 more](https://codecov.io/gh/apache/dubbo-go/pull/537/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/537?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/537?src=pr&el=footer). Last update [8a3c02c...41c9d89](https://codecov.io/gh/apache/dubbo-go/pull/537?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