Scope needs to be replaced with entityId (#2742)

"scope" can not find in serviceInventoryCache, serviceInstanceInventoryCache or endpointInventoryCache.
It needs to be replaced with entityId
This commit is contained in:
QIliang 2019-05-23 16:07:28 +08:00 committed by 吴晟 Wu Sheng
parent d95ab26308
commit 3e2fb7880d
1 changed files with 6 additions and 3 deletions

View File

@ -35,11 +35,14 @@ public class MetricFormatter {
protected String getEntityName(MetricsMetaInfo meta) {
int scope = meta.getScope();
if (DefaultScopeDefine.inServiceCatalog(scope)) {
return serviceInventoryCache.get(scope).getName();
int entityId = Integer.valueOf(meta.getId());
return serviceInventoryCache.get(entityId).getName();
} else if (DefaultScopeDefine.inServiceInstanceCatalog(scope)) {
return serviceInstanceInventoryCache.get(scope).getName();
int entityId = Integer.valueOf(meta.getId());
return serviceInstanceInventoryCache.get(entityId).getName();
} else if (DefaultScopeDefine.inEndpointCatalog(scope)) {
return endpointInventoryCache.get(scope).getName();
int entityId = Integer.valueOf(meta.getId());
return endpointInventoryCache.get(entityId).getName();
} else if (scope == DefaultScopeDefine.ALL) {
return "";
} else {