You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2021/05/20 02:43:38 UTC
[skywalking] branch master updated: Fetch further data only when
they're requested (#6976)
This is an automated email from the ASF dual-hosted git repository.
kezhenxu94 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 6c90a95 Fetch further data only when they're requested (#6976)
6c90a95 is described below
commit 6c90a954edd73b6eb706c7e6ab3fa7a0f0ae6848
Author: Zhenxu Ke <ke...@apache.org>
AuthorDate: Thu May 20 10:43:16 2021 +0800
Fetch further data only when they're requested (#6976)
---
.../skywalking/oap/query/graphql/resolver/AlarmQuery.java | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/AlarmQuery.java b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/AlarmQuery.java
index c0d38f4..cb63af7 100644
--- a/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/AlarmQuery.java
+++ b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/AlarmQuery.java
@@ -20,6 +20,7 @@ package org.apache.skywalking.oap.query.graphql.resolver;
import com.coxautodev.graphql.tools.GraphQLQueryResolver;
+import graphql.schema.DataFetchingEnvironment;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -79,7 +80,8 @@ public class AlarmQuery implements GraphQLQueryResolver {
}
public Alarms getAlarm(final Duration duration, final Scope scope, final String keyword,
- final Pagination paging, final List<Tag> tags) throws Exception {
+ final Pagination paging, final List<Tag> tags,
+ final DataFetchingEnvironment env) throws Exception {
Integer scopeId = null;
if (scope != null) {
scopeId = scope.getScopeId();
@@ -94,7 +96,14 @@ public class AlarmQuery implements GraphQLQueryResolver {
}
Alarms alarms = getQueryService().getAlarm(
scopeId, keyword, paging, startSecondTB, endSecondTB, tags);
- return findRelevantEvents(alarms, conditionPrototype);
+
+ final boolean selectEvents = env.getSelectionSet().get().entrySet().stream().anyMatch(it -> it.getKey().contains("/events/"));
+
+ if (selectEvents) {
+ return findRelevantEvents(alarms, conditionPrototype);
+ }
+
+ return alarms;
}
private Alarms findRelevantEvents(