You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2022/05/07 09:40:08 UTC

[GitHub] [skywalking] chenhaipeng commented on a diff in pull request #9003: Enhance Deprecated MetricQuery(v1) getValues querying

chenhaipeng commented on code in PR #9003:
URL: https://github.com/apache/skywalking/pull/9003#discussion_r867331302


##########
oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/MetricQuery.java:
##########
@@ -59,17 +64,28 @@ public IntValues getValues(final BatchMetricConditions metrics, final Duration d
             kv.setValue(query.readMetricsValue(condition, duration));
             values.addKVInt(kv);
         } else {
-            for (final String id : metrics.getIds()) {
-                KVInt kv = new KVInt();
-                kv.setId(id);
+            List<CompletableFuture> futureList = new ArrayList<>();
+            metrics.getIds().stream().forEach(id -> {
 
                 MetricsCondition condition = new MetricsCondition();
                 condition.setName(metrics.getName());
                 condition.setEntity(new MockEntity(id));
-
-                kv.setValue(query.readMetricsValue(condition, duration));
-                values.addKVInt(kv);
-            }
+                CompletableFuture future = CompletableFuture.supplyAsync(() -> {
+                    try {
+                        return query.readMetricsValue(condition, duration);
+                    } catch (IOException e) {
+                        log.error("query.readMetricsValue error", e);

Review Comment:
   I think the best way is to modify MetricsQueryEsDAO to support batch query of ids, ignore this pr
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org