Search in sources :

Example 1 with AgentStatusTimelineSegment

use of com.navercorp.pinpoint.web.vo.timeline.inspector.AgentStatusTimelineSegment in project pinpoint by naver.

the class AgentWarningStatServiceTest method selectTest1.

@Test
public void selectTest1() {
    Range range = Range.newRange(CURRENT_TIME - TIME, CURRENT_TIME);
    List<DeadlockThreadCountBo> mockData = createMockData(10, 5000);
    when(deadlockDao.getAgentStatList("pinpoint", range)).thenReturn(mockData);
    List<AgentStatusTimelineSegment> timelineSegmentList = agentWarningStatService.select("pinpoint", range);
    Assert.assertEquals(1, timelineSegmentList.size());
}
Also used : AgentStatusTimelineSegment(com.navercorp.pinpoint.web.vo.timeline.inspector.AgentStatusTimelineSegment) DeadlockThreadCountBo(com.navercorp.pinpoint.common.server.bo.stat.DeadlockThreadCountBo) Range(com.navercorp.pinpoint.web.vo.Range) Test(org.junit.Test)

Example 2 with AgentStatusTimelineSegment

use of com.navercorp.pinpoint.web.vo.timeline.inspector.AgentStatusTimelineSegment in project pinpoint by naver.

the class AgentInfoServiceImpl method getAgentStatusTimeline.

@Override
public InspectorTimeline getAgentStatusTimeline(String agentId, Range range, int... excludeAgentEventTypeCodes) {
    Objects.requireNonNull(agentId, "agentId");
    Objects.requireNonNull(range, "range");
    AgentStatus initialStatus = getAgentStatus(agentId, range.getFrom());
    List<AgentEvent> agentEvents = agentEventService.getAgentEvents(agentId, range);
    List<AgentStatusTimelineSegment> warningStatusTimelineSegmentList = agentWarningStatService.select(agentId, range);
    AgentStatusTimelineBuilder agentStatusTimelinebuilder = new AgentStatusTimelineBuilder(range, initialStatus, agentEvents, warningStatusTimelineSegmentList);
    AgentStatusTimeline agentStatusTimeline = agentStatusTimelinebuilder.build();
    AgentEventTimelineBuilder agentEventTimelineBuilder = new AgentEventTimelineBuilder(range);
    agentEventTimelineBuilder.from(agentEvents);
    agentEventTimelineBuilder.addFilter(new AgentEventFilter.ExcludeFilter(excludeAgentEventTypeCodes));
    AgentEventTimeline agentEventTimeline = agentEventTimelineBuilder.build();
    return new InspectorTimeline(agentStatusTimeline, agentEventTimeline);
}
Also used : AgentEventFilter(com.navercorp.pinpoint.web.filter.agent.AgentEventFilter) AgentEventTimeline(com.navercorp.pinpoint.web.vo.timeline.inspector.AgentEventTimeline) AgentStatus(com.navercorp.pinpoint.web.vo.AgentStatus) AgentStatusTimelineSegment(com.navercorp.pinpoint.web.vo.timeline.inspector.AgentStatusTimelineSegment) AgentStatusTimeline(com.navercorp.pinpoint.web.vo.timeline.inspector.AgentStatusTimeline) AgentEventTimelineBuilder(com.navercorp.pinpoint.web.vo.timeline.inspector.AgentEventTimelineBuilder) InspectorTimeline(com.navercorp.pinpoint.web.vo.timeline.inspector.InspectorTimeline) AgentEvent(com.navercorp.pinpoint.web.vo.AgentEvent) AgentStatusTimelineBuilder(com.navercorp.pinpoint.web.vo.timeline.inspector.AgentStatusTimelineBuilder)

Example 3 with AgentStatusTimelineSegment

use of com.navercorp.pinpoint.web.vo.timeline.inspector.AgentStatusTimelineSegment 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 4 with AgentStatusTimelineSegment

use of com.navercorp.pinpoint.web.vo.timeline.inspector.AgentStatusTimelineSegment 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)

Example 5 with AgentStatusTimelineSegment

use of com.navercorp.pinpoint.web.vo.timeline.inspector.AgentStatusTimelineSegment in project pinpoint by naver.

the class AgentWarningStatServiceTest method selectTest2.

@Test
public void selectTest2() {
    Range range = Range.newRange(CURRENT_TIME - TIME, CURRENT_TIME);
    List<DeadlockThreadCountBo> mockData = createMockData(10, 70000);
    when(deadlockDao.getAgentStatList("pinpoint", range)).thenReturn(mockData);
    List<AgentStatusTimelineSegment> timelineSegmentList = agentWarningStatService.select("pinpoint", range);
    Assert.assertEquals(10, timelineSegmentList.size());
}
Also used : AgentStatusTimelineSegment(com.navercorp.pinpoint.web.vo.timeline.inspector.AgentStatusTimelineSegment) DeadlockThreadCountBo(com.navercorp.pinpoint.common.server.bo.stat.DeadlockThreadCountBo) Range(com.navercorp.pinpoint.web.vo.Range) Test(org.junit.Test)

Aggregations

AgentStatusTimelineSegment (com.navercorp.pinpoint.web.vo.timeline.inspector.AgentStatusTimelineSegment)5 AgentWarningStatDataPoint (com.navercorp.pinpoint.common.server.bo.stat.AgentWarningStatDataPoint)2 DeadlockThreadCountBo (com.navercorp.pinpoint.common.server.bo.stat.DeadlockThreadCountBo)2 Range (com.navercorp.pinpoint.web.vo.Range)2 Test (org.junit.Test)2 AgentEventFilter (com.navercorp.pinpoint.web.filter.agent.AgentEventFilter)1 AgentEvent (com.navercorp.pinpoint.web.vo.AgentEvent)1 AgentStatus (com.navercorp.pinpoint.web.vo.AgentStatus)1 AgentEventTimeline (com.navercorp.pinpoint.web.vo.timeline.inspector.AgentEventTimeline)1 AgentEventTimelineBuilder (com.navercorp.pinpoint.web.vo.timeline.inspector.AgentEventTimelineBuilder)1 AgentStatusTimeline (com.navercorp.pinpoint.web.vo.timeline.inspector.AgentStatusTimeline)1 AgentStatusTimelineBuilder (com.navercorp.pinpoint.web.vo.timeline.inspector.AgentStatusTimelineBuilder)1 InspectorTimeline (com.navercorp.pinpoint.web.vo.timeline.inspector.InspectorTimeline)1 ArrayList (java.util.ArrayList)1