Search in sources :

Example 1 with AgentWarningStatDataPoint

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;
}
Also used : HashMap(java.util.HashMap) AgentWarningStatDataPoint(com.navercorp.pinpoint.common.server.bo.stat.AgentWarningStatDataPoint) ArrayList(java.util.ArrayList) List(java.util.List)

Example 2 with AgentWarningStatDataPoint

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;
}
Also used : AgentStatusTimelineSegment(com.navercorp.pinpoint.web.vo.timeline.inspector.AgentStatusTimelineSegment) AgentWarningStatDataPoint(com.navercorp.pinpoint.common.server.bo.stat.AgentWarningStatDataPoint)

Example 3 with AgentWarningStatDataPoint

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;
}
Also used : AgentStatusTimelineSegment(com.navercorp.pinpoint.web.vo.timeline.inspector.AgentStatusTimelineSegment) ArrayList(java.util.ArrayList) AgentWarningStatDataPoint(com.navercorp.pinpoint.common.server.bo.stat.AgentWarningStatDataPoint) AgentWarningStatDataPoint(com.navercorp.pinpoint.common.server.bo.stat.AgentWarningStatDataPoint)

Aggregations

AgentWarningStatDataPoint (com.navercorp.pinpoint.common.server.bo.stat.AgentWarningStatDataPoint)3 AgentStatusTimelineSegment (com.navercorp.pinpoint.web.vo.timeline.inspector.AgentStatusTimelineSegment)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)1 List (java.util.List)1