skywalking-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [skywalking] wu-sheng commented on a change in pull request #6066: Improvement Influxdb query performance
Date Sat, 26 Dec 2020 01:42:09 GMT

wu-sheng commented on a change in pull request #6066:
URL: https://github.com/apache/skywalking/pull/6066#discussion_r548930555



##########
File path: oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/worker/MetricsPersistentWorker.java
##########
@@ -209,15 +211,11 @@ private void loadFromStorage(List<Metrics> metrics) throws IOException
{
             context.clear();
         }
 
-        List<String> notInCacheIds = new ArrayList<>();
-        for (Metrics metric : metrics) {
-            if (!context.containsKey(metric)) {
-                notInCacheIds.add(metric.id());
-            }
-        }
-
-        if (notInCacheIds.size() > 0) {
-            List<Metrics> metricsList = metricsDAO.multiGet(model, notInCacheIds);
+        List<Metrics> notInCacheMetrics = metrics.stream()
+                                                 .filter(m -> !context.containsKey(m))
+                                                 .collect(Collectors.toList());

Review comment:
       ```java
   final Stream<Metrics> metricsStream = metrics.stream().filter(m -> !context.containsKey(m));
   ```
   
   I think this stream is better choice for `metricsDAO#multiGet`, WDYT?




----------------------------------------------------------------
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.

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



Mime
View raw message