You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by zh...@apache.org on 2021/10/21 07:23:07 UTC
[skywalking] branch master updated: support search browser service
(#7975)
This is an automated email from the ASF dual-hosted git repository.
zhangwei24 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 929dc0e support search browser service (#7975)
929dc0e is described below
commit 929dc0e91f06e64a1d9abeedde9279158cce4c82
Author: zhang-wei <zh...@apache.org>
AuthorDate: Thu Oct 21 15:22:43 2021 +0800
support search browser service (#7975)
---
CHANGES.md | 1 +
.../oap/server/core/query/MetadataQueryService.java | 20 ++++++++++++++++++--
.../server/core/storage/query/IMetadataQueryDAO.java | 9 ++++++---
.../oap/query/graphql/resolver/MetadataQuery.java | 10 ++++++++++
.../src/main/resources/query-protocol | 2 +-
.../elasticsearch/query/MetadataQueryEsDAO.java | 8 ++++----
.../storage/plugin/influxdb/query/MetadataQuery.java | 8 ++++----
.../plugin/jdbc/h2/dao/H2MetadataQueryDAO.java | 8 ++++----
8 files changed, 48 insertions(+), 18 deletions(-)
diff --git a/CHANGES.md b/CHANGES.md
index b8fac31..dac41f6 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -46,6 +46,7 @@ Release Notes.
* Add `Message Queue Avg Consuming Latency` metric for MQ consuming service and endpoint.
* Support `-Inf` as bucket in the meter system.
* Fix setting wrong field when combining `Event`s.
+* Support search browser service.
#### UI
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 6459208..044e705 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
@@ -23,6 +23,7 @@ import java.util.List;
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.NodeType;
import org.apache.skywalking.oap.server.core.query.type.Database;
import org.apache.skywalking.oap.server.core.query.type.Endpoint;
import org.apache.skywalking.oap.server.core.query.type.EndpointInfo;
@@ -69,7 +70,18 @@ public class MetadataQueryService implements org.apache.skywalking.oap.server.li
public List<Service> searchServices(final long startTimestamp, final long endTimestamp,
final String keyword) throws IOException {
- return getMetadataQueryDAO().searchServices(keyword).stream().distinct().collect(Collectors.toList());
+ return getMetadataQueryDAO().searchServices(NodeType.Normal, keyword)
+ .stream()
+ .distinct()
+ .collect(Collectors.toList());
+ }
+
+ public List<Service> searchBrowserServices(final long startTimestamp, final long endTimestamp,
+ final String keyword) throws IOException {
+ return getMetadataQueryDAO().searchServices(NodeType.Browser, keyword)
+ .stream()
+ .distinct()
+ .collect(Collectors.toList());
}
public List<ServiceInstance> getServiceInstances(final long startTimestamp, final long endTimestamp,
@@ -85,7 +97,11 @@ public class MetadataQueryService implements org.apache.skywalking.oap.server.li
}
public Service searchService(final String serviceCode) throws IOException {
- return getMetadataQueryDAO().searchService(serviceCode);
+ return getMetadataQueryDAO().searchService(NodeType.Normal, serviceCode);
+ }
+
+ public Service searchBrowserService(final String serviceCode) throws IOException {
+ return getMetadataQueryDAO().searchService(NodeType.Browser, serviceCode);
}
public EndpointInfo getEndpointInfo(final String endpointId) throws IOException {
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/query/IMetadataQueryDAO.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/query/IMetadataQueryDAO.java
index ad792e0..27ed47d 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/query/IMetadataQueryDAO.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/query/IMetadataQueryDAO.java
@@ -20,6 +20,7 @@ package org.apache.skywalking.oap.server.core.storage.query;
import java.io.IOException;
import java.util.List;
+import org.apache.skywalking.oap.server.core.analysis.NodeType;
import org.apache.skywalking.oap.server.core.query.type.Database;
import org.apache.skywalking.oap.server.core.query.type.Endpoint;
import org.apache.skywalking.oap.server.core.query.type.Service;
@@ -44,16 +45,18 @@ public interface IMetadataQueryDAO extends DAO {
List<Database> getAllDatabases() throws IOException;
/**
- * @param keyword to filter the normal service
+ * @param nodeType describe which kind of node of Service
+ * @param keyword to filter the normal service
* @return the list of normal services matching the given keyword
*/
- List<Service> searchServices(final String keyword) throws IOException;
+ List<Service> searchServices(final NodeType nodeType, final String keyword) throws IOException;
/**
+ * @param nodeType describe which kind of node of Service
* @param serviceCode to literal match
* @return the service matching the given full name.
*/
- Service searchService(final String serviceCode) throws IOException;
+ Service searchService(final NodeType nodeType, final String serviceCode) throws IOException;
/**
* @param keyword to filter the endpoints
diff --git a/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/MetadataQuery.java b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/MetadataQuery.java
index c538a0e..6e978b3 100644
--- a/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/MetadataQuery.java
+++ b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/MetadataQuery.java
@@ -81,6 +81,16 @@ public class MetadataQuery implements GraphQLQueryResolver {
return getMetadataQueryService().searchService(serviceCode);
}
+ public List<Service> searchBrowserServices(final Duration duration,
+ final String keyword) throws IOException, ParseException {
+ return getMetadataQueryService().searchBrowserServices(
+ duration.getStartTimestamp(), duration.getEndTimestamp(), keyword);
+ }
+
+ public Service searchBrowserService(final String serviceCode) throws IOException {
+ return getMetadataQueryService().searchBrowserService(serviceCode);
+ }
+
public List<ServiceInstance> getServiceInstances(final Duration duration,
final String serviceId) throws IOException, ParseException {
return getMetadataQueryService().getServiceInstances(
diff --git a/oap-server/server-query-plugin/query-graphql-plugin/src/main/resources/query-protocol b/oap-server/server-query-plugin/query-graphql-plugin/src/main/resources/query-protocol
index 47202fc..2d1b72b 160000
--- a/oap-server/server-query-plugin/query-graphql-plugin/src/main/resources/query-protocol
+++ b/oap-server/server-query-plugin/query-graphql-plugin/src/main/resources/query-protocol
@@ -1 +1 @@
-Subproject commit 47202fc1eaa1864c587a78f423a0685ffbe294ad
+Subproject commit 2d1b72baab57126e0341e2984e2beb95b39cb385
diff --git a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/MetadataQueryEsDAO.java b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/MetadataQueryEsDAO.java
index b34e971..360ee53 100644
--- a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/MetadataQueryEsDAO.java
+++ b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/MetadataQueryEsDAO.java
@@ -109,13 +109,13 @@ public class MetadataQueryEsDAO extends EsDAO implements IMetadataQueryDAO {
}
@Override
- public List<Service> searchServices(String keyword) throws IOException {
+ public List<Service> searchServices(final NodeType nodeType, final String keyword) throws IOException {
final String index =
IndexController.LogicIndicesRegister.getPhysicalTableName(ServiceTraffic.INDEX_NAME);
final BoolQueryBuilder query =
Query.bool()
- .must(Query.term(ServiceTraffic.NODE_TYPE, NodeType.Normal.value()));
+ .must(Query.term(ServiceTraffic.NODE_TYPE, nodeType.value()));
final SearchBuilder search = Search.builder().query(query).size(queryMaxSize);
if (!Strings.isNullOrEmpty(keyword)) {
@@ -128,12 +128,12 @@ public class MetadataQueryEsDAO extends EsDAO implements IMetadataQueryDAO {
}
@Override
- public Service searchService(String serviceCode) throws IOException {
+ public Service searchService(final NodeType nodeType, final String serviceCode) throws IOException {
final String index =
IndexController.LogicIndicesRegister.getPhysicalTableName(ServiceTraffic.INDEX_NAME);
final BoolQueryBuilder query =
Query.bool()
- .must(Query.term(ServiceTraffic.NODE_TYPE, NodeType.Normal.value()))
+ .must(Query.term(ServiceTraffic.NODE_TYPE, nodeType.value()))
.must(Query.term(ServiceTraffic.NAME, serviceCode));
final SearchBuilder search = Search.builder().query(query).size(1);
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/MetadataQuery.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/MetadataQuery.java
index d54620b..741ec15 100644
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/MetadataQuery.java
+++ b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/MetadataQuery.java
@@ -110,10 +110,10 @@ public class MetadataQuery implements IMetadataQueryDAO {
}
@Override
- public List<Service> searchServices(String keyword) throws IOException {
+ public List<Service> searchServices(final NodeType nodeType, final String keyword) throws IOException {
final WhereQueryImpl<SelectQueryImpl> where = select(ID_COLUMN, NAME, ServiceTraffic.GROUP)
.from(client.getDatabase(), ServiceTraffic.INDEX_NAME)
- .where(eq(TagName.NODE_TYPE, String.valueOf(NodeType.Normal.value())));
+ .where(eq(TagName.NODE_TYPE, String.valueOf(nodeType.value())));
if (!Strings.isNullOrEmpty(keyword)) {
where.and(contains(NAME, keyword));
}
@@ -121,10 +121,10 @@ public class MetadataQuery implements IMetadataQueryDAO {
}
@Override
- public Service searchService(String serviceCode) throws IOException {
+ public Service searchService(final NodeType nodeType, final String serviceCode) throws IOException {
final WhereQueryImpl<SelectQueryImpl> whereQuery = select(ID_COLUMN, NAME, ServiceTraffic.GROUP)
.from(client.getDatabase(), ServiceTraffic.INDEX_NAME)
- .where(eq(TagName.NODE_TYPE, String.valueOf(NodeType.Normal.value())));
+ .where(eq(TagName.NODE_TYPE, String.valueOf(nodeType.value())));
whereQuery.and(eq(NAME, serviceCode));
return buildServices(whereQuery).get(0);
}
diff --git a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2MetadataQueryDAO.java b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2MetadataQueryDAO.java
index 9c25e6a..2fd34f8 100644
--- a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2MetadataQueryDAO.java
+++ b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2MetadataQueryDAO.java
@@ -123,12 +123,12 @@ public class H2MetadataQueryDAO implements IMetadataQueryDAO {
}
@Override
- public List<Service> searchServices(String keyword) throws IOException {
+ public List<Service> searchServices(final NodeType nodeType, final String keyword) throws IOException {
StringBuilder sql = new StringBuilder();
List<Object> condition = new ArrayList<>(5);
sql.append("select * from ").append(ServiceTraffic.INDEX_NAME).append(" where ");
sql.append(ServiceTraffic.NODE_TYPE).append("=?");
- condition.add(NodeType.Normal.value());
+ condition.add(nodeType.value());
if (!Strings.isNullOrEmpty(keyword)) {
sql.append(" and ").append(ServiceTraffic.NAME).append(" like concat('%',?,'%')");
condition.add(keyword);
@@ -146,12 +146,12 @@ public class H2MetadataQueryDAO implements IMetadataQueryDAO {
}
@Override
- public Service searchService(String serviceCode) throws IOException {
+ public Service searchService(NodeType nodeType, String serviceCode) throws IOException {
StringBuilder sql = new StringBuilder();
List<Object> condition = new ArrayList<>(5);
sql.append("select * from ").append(ServiceTraffic.INDEX_NAME).append(" where ");
sql.append(ServiceTraffic.NODE_TYPE).append("=?");
- condition.add(NodeType.Normal.value());
+ condition.add(nodeType.value());
sql.append(" and ").append(ServiceTraffic.NAME).append(" = ?");
condition.add(serviceCode);