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:49 UTC
[skywalking] branch oap-metric-query created (now f0d41f9)
This is an automated email from the ASF dual-hosted git repository.
hanahmily pushed a change to branch oap-metric-query
in repository https://gitbox.apache.org/repos/asf/skywalking.git.
at f0d41f9 Sort linear metric query result
This branch includes the following new commits:
new f0d41f9 Sort linear metric query result
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[skywalking] 01/01: Sort linear metric query result
Posted by ha...@apache.org.
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;
}