use of com.navercorp.pinpoint.common.server.bo.stat.AgentWarningStatDataPoint in project pinpoint by naver.
the class AgentWarningStatServiceImpl method parseByStartTimestamp.
private Map<Long, List<AgentWarningStatDataPoint>> parseByStartTimestamp(List<AgentWarningStatDataPoint> agentWarningStatDataPointList) {
if (CollectionUtils.isEmpty(agentWarningStatDataPointList)) {
return Collections.emptyMap();
}
Map<Long, List<AgentWarningStatDataPoint>> partitions = new HashMap<>();
for (AgentWarningStatDataPoint agentWarningStatDataPoint : agentWarningStatDataPointList) {
long startTimestamp = agentWarningStatDataPoint.getStartTimestamp();
List<AgentWarningStatDataPoint> partition = partitions.computeIfAbsent(startTimestamp, k -> new ArrayList<>());
partition.add(agentWarningStatDataPoint);
}
return partitions;
}
use of com.navercorp.pinpoint.common.server.bo.stat.AgentWarningStatDataPoint in project pinpoint by naver.
the class AgentWarningStatServiceImpl method createUnstableTimelineSegment.
private AgentStatusTimelineSegment createUnstableTimelineSegment(List<AgentWarningStatDataPoint> agentWarningStatDataPointList) {
if (CollectionUtils.isEmpty(agentWarningStatDataPointList)) {
return null;
}
AgentWarningStatDataPoint first = CollectionUtils.firstElement(agentWarningStatDataPointList);
AgentWarningStatDataPoint last = CollectionUtils.lastElement(agentWarningStatDataPointList);
AgentStatusTimelineSegment timelineSegment = new AgentStatusTimelineSegment();
timelineSegment.setStartTimestamp(first.getTimestamp());
timelineSegment.setEndTimestamp(last.getTimestamp());
timelineSegment.setValue(AgentState.UNSTABLE_RUNNING);
return timelineSegment;
}
use of com.navercorp.pinpoint.common.server.bo.stat.AgentWarningStatDataPoint in project pinpoint by naver.
the class AgentWarningStatServiceImpl method createTimelineSegment0.
private List<AgentStatusTimelineSegment> createTimelineSegment0(List<AgentWarningStatDataPoint> agentWarningStatDataPointList) {
if (CollectionUtils.isEmpty(agentWarningStatDataPointList)) {
return Collections.emptyList();
}
List<AgentStatusTimelineSegment> timelineSegmentList = new ArrayList<>();
long beforeTimestamp = -1;
int index = 0;
for (int i = 0; i < agentWarningStatDataPointList.size(); i++) {
AgentWarningStatDataPoint agentWarningStatDataPoint = agentWarningStatDataPointList.get(i);
if (i == 0) {
beforeTimestamp = agentWarningStatDataPoint.getTimestamp();
} else {
boolean needSeparation = agentWarningStatDataPoint.getTimestamp() > beforeTimestamp + LIMIT_TIME;
if (needSeparation) {
AgentStatusTimelineSegment timelineSegment = createUnstableTimelineSegment(agentWarningStatDataPointList.subList(index, i));
timelineSegmentList.add(timelineSegment);
beforeTimestamp = agentWarningStatDataPoint.getTimestamp();
index = i;
}
beforeTimestamp = agentWarningStatDataPoint.getTimestamp();
}
}
AgentStatusTimelineSegment timelineSegment = createUnstableTimelineSegment(agentWarningStatDataPointList.subList(index, agentWarningStatDataPointList.size()));
timelineSegmentList.add(timelineSegment);
return timelineSegmentList;
}
Aggregations