mrproliu commented on code in PR #13807:
URL: https://github.com/apache/skywalking/pull/13807#discussion_r3055211856


##########
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/profiling/pprof/PprofQueryService.java:
##########
@@ -105,15 +105,9 @@ public PprofStackTree queryPprofData(String taskId, 
List<String> instanceIds) th
     }
 
     public List<PprofTaskLog> queryPprofTaskLogs(String taskId) throws 
IOException {
-        List<PprofTaskLog> taskLogList = getTaskLogQueryDAO().getTaskLogList();
-        return findMatchedLogs(taskId, taskLogList);
-    }
-
-    private List<PprofTaskLog> findMatchedLogs(final String taskID, final 
List<PprofTaskLog> allLogs) {
-        return allLogs.stream()
-                      .filter(l -> Objects.equals(l.getId(), taskID))
-                      .map(this::extendTaskLog)
-                      .collect(Collectors.toList());
+        return getTaskLogQueryDAO().getTaskLogList(taskId).stream()
+                                   .map(this::extendTaskLog)
+                                   .collect(Collectors.toList());

Review Comment:
   Added the task id checker in each implementation.



##########
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/profiling/pprof/IPprofTaskLogQueryDAO.java:
##########
@@ -25,7 +25,11 @@
 
 public interface IPprofTaskLogQueryDAO extends DAO {
     /**
-     * search all task log list in appoint task id
+     * Search task logs by the given task id.
+     *
+     * @param taskId the task id to filter by, must not be null or blank
+     * @return the task logs associated with the given task id
+     * @throws IOException if the query fails
      */
-    List<PprofTaskLog> getTaskLogList() throws IOException;
+    List<PprofTaskLog> getTaskLogList(String taskId) throws IOException;

Review Comment:
   Added the checker. 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to