You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2022/03/10 05:41:10 UTC

[skywalking] branch master updated: return all Layer definition names within OAP (#8651)

This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git


The following commit(s) were added to refs/heads/master by this push:
     new 3a31cbe  return all Layer definition names within OAP (#8651)
3a31cbe is described below

commit 3a31cbe222676e85ef834735b26a64e791c8f9c3
Author: Kai <wa...@foxmail.com>
AuthorDate: Thu Mar 10 13:40:23 2022 +0800

    return all Layer definition names within OAP (#8651)
---
 .../skywalking/oap/server/core/query/MetadataQueryService.java | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/MetadataQueryService.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/MetadataQueryService.java
index 282a9d7..ee75a5d 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/MetadataQueryService.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/MetadataQueryService.java
@@ -20,12 +20,13 @@ package org.apache.skywalking.oap.server.core.query;
 
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.HashSet;
+import java.util.Arrays;
 import java.util.List;
 import java.util.Set;
 import java.util.stream.Collectors;
 import org.apache.skywalking.oap.server.core.Const;
 import org.apache.skywalking.oap.server.core.analysis.IDManager;
+import org.apache.skywalking.oap.server.core.analysis.Layer;
 import org.apache.skywalking.oap.server.core.query.type.Endpoint;
 import org.apache.skywalking.oap.server.core.query.type.EndpointInfo;
 import org.apache.skywalking.oap.server.core.query.type.Service;
@@ -51,12 +52,7 @@ public class MetadataQueryService implements org.apache.skywalking.oap.server.li
     }
 
     public Set<String> listLayers() throws IOException {
-        Set<String> layers = new HashSet<>();
-        getMetadataQueryDAO().listServices(null, null).forEach(service -> {
-            layers.addAll(service.getLayers());
-
-        });
-        return layers;
+        return Arrays.stream(Layer.values()).filter(layer -> layer.value() > 0).map(Layer::name).collect(Collectors.toSet());
     }
 
     public List<Service> listServices(final String layer, final String group) throws IOException {