fix overlapping time ranges profile analyze error (#4487)
Co-authored-by: Mrproliu <mrproliu@lagou.com>
This commit is contained in:
parent
ced5cb2828
commit
5ea0133a62
|
|
@ -85,7 +85,7 @@ public class ProfileAnalyzer {
|
|||
LOGGER.warn(e.getMessage(), e);
|
||||
return Collections.<ProfileThreadSnapshotRecord>emptyList();
|
||||
}
|
||||
}).flatMap(Collection::stream).map(ProfileStack::deserialize).collect(Collectors.toList());
|
||||
}).flatMap(Collection::stream).map(ProfileStack::deserialize).distinct().collect(Collectors.toList());
|
||||
|
||||
// analyze
|
||||
analyzation.setTrees(analyze(stacks));
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ package org.apache.skywalking.oap.server.core.profile.analyze;
|
|||
import com.google.common.primitives.Ints;
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.skywalking.apm.network.language.profile.ThreadStack;
|
||||
import org.apache.skywalking.oap.server.core.profile.ProfileThreadSnapshotRecord;
|
||||
|
|
@ -56,4 +58,17 @@ public class ProfileStack implements Comparable<ProfileStack> {
|
|||
public int compareTo(ProfileStack o) {
|
||||
return Ints.compare(sequence, o.sequence);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
ProfileStack that = (ProfileStack) o;
|
||||
return sequence == that.sequence;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(sequence);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -244,3 +244,20 @@ list:
|
|||
- code: A
|
||||
count: 5
|
||||
duration: 30:30
|
||||
|
||||
# case 9(multiple time ranges with overlapping time)
|
||||
- data:
|
||||
limit: 10
|
||||
timeRanges: 0-2,1-3,5-6
|
||||
snapshots:
|
||||
- A
|
||||
- A
|
||||
- A
|
||||
- A
|
||||
- B
|
||||
- A
|
||||
- A
|
||||
expected:
|
||||
- code: A
|
||||
count: 6
|
||||
duration: 40:40
|
||||
|
|
|
|||
Loading…
Reference in New Issue