Fix GraphQL profile queried error when cannot matches any snapshot (#4490)

* Fix GraphQL profile queried error when cannot matches any snapshot

* fix adding list bug

Co-authored-by: Mrproliu <mrproliu@lagou.com>
Co-authored-by: 吴晟 Wu Sheng <wu.sheng@foxmail.com>
This commit is contained in:
mrproliu 2020-03-11 19:24:44 +08:00 committed by GitHub
parent 39489ebc1e
commit cd2fb513a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -88,7 +88,10 @@ public class ProfileAnalyzer {
}).flatMap(Collection::stream).map(ProfileStack::deserialize).distinct().collect(Collectors.toList());
// analyze
analyzation.setTrees(analyze(stacks));
final List<ProfileStackTree> trees = analyze(stacks);
if (trees != null) {
analyzation.getTrees().addAll(trees);
}
return analyzation;
}

View File

@ -18,6 +18,7 @@
package org.apache.skywalking.oap.server.core.query.entity;
import java.util.ArrayList;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
@ -33,4 +34,7 @@ public class ProfileAnalyzation {
// thread stack dump analyze trees
private List<ProfileStackTree> trees;
public ProfileAnalyzation() {
this.trees = new ArrayList<>();
}
}