You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ha...@apache.org on 2020/06/08 15:49:50 UTC
[skywalking] 01/01: Sort linear metric query result
This is an automated email from the ASF dual-hosted git repository.
hanahmily pushed a commit to branch oap-metric-query
in repository https://gitbox.apache.org/repos/asf/skywalking.git
commit f0d41f90f1b6f9d2ff49eddd7f77f320d05ecc65
Author: Gao Hongtao <ha...@gmail.com>
AuthorDate: Mon Jun 8 23:47:04 2020 +0800
Sort linear metric query result
Signed-off-by: Gao Hongtao <ha...@gmail.com>
---
.../oap/query/graphql/resolver/MetricQuery.java | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/MetricQuery.java b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/MetricQuery.java
index 4f293f7..393fde5 100644
--- a/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/MetricQuery.java
+++ b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/MetricQuery.java
@@ -99,10 +99,10 @@ public class MetricQuery implements GraphQLQueryResolver {
final List<MetricsValues> metricsValues = query.readLabeledMetricsValues(condition, labels, duration);
List<IntValues> response = new ArrayList<>(metricsValues.size());
- metricsValues.forEach(value -> {
- response.add(value.getValues());
- });
-
+ labels.forEach(l -> metricsValues.stream()
+ .filter(m -> m.getLabel().equals(l))
+ .findAny()
+ .ifPresent(values -> response.add(values.getValues())));
return response;
}
@@ -118,10 +118,10 @@ public class MetricQuery implements GraphQLQueryResolver {
final List<MetricsValues> metricsValues = query.readLabeledMetricsValues(condition, labels, duration);
List<IntValues> response = new ArrayList<>(metricsValues.size());
- metricsValues.forEach(value -> {
- response.add(value.getValues());
- });
-
+ labels.forEach(l -> metricsValues.stream()
+ .filter(m -> m.getLabel().equals(l))
+ .findAny()
+ .ifPresent(values -> response.add(values.getValues())));
return response;
}