return all Layer definition names within OAP (#8651)

This commit is contained in:
Kai 2022-03-10 13:40:23 +08:00 committed by GitHub
parent c7c4c6770d
commit 3a31cbe222
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 7 deletions

View File

@ -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 {