wu-sheng commented on a change in pull request #4335: Provide profile analyze 
query
URL: https://github.com/apache/skywalking/pull/4335#discussion_r377051247
 
 

 ##########
 File path: 
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/profile/analyze/ProfileAnalyzer.java
 ##########
 @@ -32,14 +39,90 @@
  */
 public class ProfileAnalyzer {
 
+    private static final Logger LOGGER = 
LoggerFactory.getLogger(ProfileAnalyzer.class);
+
     private static final ProfileAnalyzeCollector ANALYZE_COLLECTOR = new 
ProfileAnalyzeCollector();
 
+    private final int threadSnapshotAnalyzeBatchSize;
+    private final int analyzeSnapshotMaxSize;
+
+    private final ModuleManager moduleManager;
+    private IProfileThreadSnapshotQueryDAO profileThreadSnapshotQueryDAO;
+
+    public ProfileAnalyzer(ModuleManager moduleManager, int 
snapshotAnalyzeBatchSize, int analyzeSnapshotMaxSize) {
+        this.moduleManager = moduleManager;
+        this.threadSnapshotAnalyzeBatchSize = snapshotAnalyzeBatchSize;
+        this.analyzeSnapshotMaxSize = analyzeSnapshotMaxSize;
+    }
+
+    /**
+     * search snapshots and analyze
+     * @param segmentId
+     * @param start
+     * @param end
+     * @return
+     */
+    public ProfileAnalyzation analyze(String segmentId, long start, long end) 
throws IOException {
+        ProfileAnalyzation analyzation = new ProfileAnalyzation();
+
+        // query sequence range list
+        SequenceSearch sequenceSearch = getAllSequenceRange(segmentId, start, 
end);
+        if (sequenceSearch == null) {
+            analyzation.setTip("Data not found");
+            return analyzation;
+        }
+        if (sequenceSearch.totalSequenceCount > analyzeSnapshotMaxSize) {
+            analyzation.setTip("Out of snapshot analyze limit, current size:" 
+ sequenceSearch.totalSequenceCount + ", only analyze snapshot count: " + 
analyzeSnapshotMaxSize);
 
 Review comment:
   `Out of snapshot analyze limit,  xxx snapshots found, but analysis first yyy 
snapshots only`.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to