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 08:45:55 UTC
[GitHub] [skywalking] chenhaipeng commented on a diff in pull request #9003: Feat/query ids async
chenhaipeng commented on code in PR #9003:
URL: https://github.com/apache/skywalking/pull/9003#discussion_r867325973
##########
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 LinkedList<>();
+ 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(() -> {
Review Comment:
This means that the id is queried concurrently, and you don't have to wait for each result before proceeding the next time.
--
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