Aias00 commented on code in PR #3433:
URL: https://github.com/apache/dubbo-go/pull/3433#discussion_r3540770058


##########
filter/otel/trace/attachment.go:
##########
@@ -39,21 +39,26 @@ func (s *metadataSupplier) Get(key string) string {
        if s.metadata == nil {
                return ""
        }
-       item, ok := s.metadata[key].([]string)
-       if !ok {
+       val, ok := s.metadata[key]
+       if !ok || val == nil {
                return ""
        }
-       if len(item) == 0 {
-               return ""
+       // Handle []string (produced by triple's generateAttachments and by Set 
below)
+       if item, ok := val.([]string); ok && len(item) > 0 {
+               return item[0]
+       }
+       // Handle string (defensive: for any externally-set string values)
+       if str, ok := val.(string); ok {
+               return str
        }
-       return item[0]
+       return ""
 }

Review Comment:
   okay, will do this later



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to