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());
}
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);
}
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;
}
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;
}
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());
}
Aggregations