Modo-me commented on code in PR #3685:
URL: https://github.com/apache/dubbo-go/pull/3685#discussion_r3827152885


##########
registry/servicediscovery/service_instances_changed_listener_impl.go:
##########
@@ -277,8 +281,23 @@ func GetMetadataInfo(app string, instance 
registry.ServiceInstance, revision str
                initCache(app)
        })
        cacheKey := metadataCacheKey(app, registryId, revision)
-       if metadataInfo, ok := metaCache.Get(cacheKey); ok {
-               return metadataInfo.(*info.MetadataInfo), nil
+       if cached, ok := metaCache.Get(cacheKey); ok {
+               logger.Debugf("[Metadata][Cache] hit app=%s registry=%s 
revision=%s host=%s",
+                       app, registryId, revision, instance.GetHost())
+               event := 
metricsMetadata.NewMetadataMetricTimeEvent(metricsMetadata.MetadataCache)
+               event.Succ = true
+               event.Attachment[metricsMetadata.TagProviderApp] = app
+               metrics.Publish(event)
+               metadataInfo := cached.(*info.MetadataInfo)
+               if metadataInfo == nil {
+                       publishMetadataFetchEvent(app, registryId, revision, 
instance.GetHost(),
+                               metricsMetadata.SourceCache, 
metricsMetadata.StorageTypeCache, metricsMetadata.ResultFailure,
+                               perrors.New("typed nil metadata in cache"))
+                       return nil, nil
+               }
+               publishMetadataFetchEvent(app, registryId, revision, 
instance.GetHost(),
+                       metricsMetadata.SourceCache, 
metricsMetadata.StorageTypeCache, metricsMetadata.ResultSuccess, nil)
+               return metadataInfo, nil

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: [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