use of com.navercorp.pinpoint.web.vo.AgentEvent in project pinpoint by naver.
the class AgentEventTimelineTest method multipleFilters.
@Test
public void multipleFilters() {
// Given
Range timelineRange = new Range(100, 200);
List<AgentEvent> agentEvents = Arrays.asList(createAgentEvent(110, AgentEventType.AGENT_PING), createAgentEvent(120, AgentEventType.AGENT_CONNECTED), createAgentEvent(130, AgentEventType.AGENT_SHUTDOWN), createAgentEvent(140, AgentEventType.AGENT_UNEXPECTED_SHUTDOWN), createAgentEvent(150, AgentEventType.AGENT_CLOSED_BY_SERVER), createAgentEvent(160, AgentEventType.AGENT_UNEXPECTED_CLOSE_BY_SERVER), createAgentEvent(170, AgentEventType.USER_THREAD_DUMP), createAgentEvent(180, AgentEventType.OTHER));
Set<AgentEventType> includedAgentEventTypes = new HashSet<AgentEventType>() {
{
add(AgentEventType.AGENT_PING);
add(AgentEventType.AGENT_CONNECTED);
add(AgentEventType.AGENT_SHUTDOWN);
add(AgentEventType.AGENT_CLOSED_BY_SERVER);
}
};
AgentEventFilter excludeUnexpectedEventsFilter = new AgentEventFilter.ExcludeFilter(AgentEventType.AGENT_UNEXPECTED_SHUTDOWN, AgentEventType.AGENT_UNEXPECTED_CLOSE_BY_SERVER);
AgentEventFilter excludeUserThreadDumpFilter = new AgentEventFilter.ExcludeFilter(AgentEventType.USER_THREAD_DUMP);
AgentEventFilter excludeOtherFilter = new AgentEventFilter.ExcludeFilter(AgentEventType.OTHER);
// When
AgentEventTimeline timeline = new AgentEventTimelineBuilder(timelineRange, 1).from(agentEvents).addFilter(excludeUnexpectedEventsFilter).addFilter(excludeUserThreadDumpFilter).addFilter(excludeOtherFilter).build();
// Then
int allEventsTotalCount = 0;
for (AgentEventTimelineSegment segment : timeline.getTimelineSegments()) {
AgentEventMarker marker = segment.getValue();
allEventsTotalCount += marker.getTotalCount();
Map<AgentEventType, Integer> eventTypeCountMap = marker.getTypeCounts();
Assert.assertTrue(includedAgentEventTypes.containsAll(eventTypeCountMap.keySet()));
Assert.assertFalse(eventTypeCountMap.keySet().contains(AgentEventType.AGENT_UNEXPECTED_SHUTDOWN));
Assert.assertFalse(eventTypeCountMap.keySet().contains(AgentEventType.AGENT_UNEXPECTED_CLOSE_BY_SERVER));
Assert.assertFalse(eventTypeCountMap.keySet().contains(AgentEventType.USER_THREAD_DUMP));
Assert.assertFalse(eventTypeCountMap.keySet().contains(AgentEventType.OTHER));
}
Assert.assertEquals(allEventsTotalCount, includedAgentEventTypes.size());
}
use of com.navercorp.pinpoint.web.vo.AgentEvent in project pinpoint by naver.
the class AgentEventTimelineTest method createSegment.
private AgentEventTimelineSegment createSegment(long startTimestamp, long endTimestamp, List<AgentEvent> agentEvents) {
AgentEventTimelineSegment segment = new AgentEventTimelineSegment();
segment.setStartTimestamp(startTimestamp);
segment.setEndTimestamp(endTimestamp);
AgentEventMarker agentEventMarker = new AgentEventMarker();
for (AgentEvent agentEvent : agentEvents) {
agentEventMarker.addAgentEvent(agentEvent);
}
segment.setValue(agentEventMarker);
return segment;
}
use of com.navercorp.pinpoint.web.vo.AgentEvent in project pinpoint by naver.
the class AgentEventTimelineTest method nullFilter.
@Test
public void nullFilter() {
// Given
Range timelineRange = new Range(100, 200);
List<AgentEvent> agentEvents = Arrays.asList(createAgentEvent(140, AgentEventType.AGENT_PING), createAgentEvent(190, AgentEventType.AGENT_PING));
List<AgentEventTimelineSegment> expectedTimelineSegments = Collections.singletonList(createSegment(100, 200, agentEvents));
// When
AgentEventTimeline timeline = new AgentEventTimelineBuilder(timelineRange, 1).from(agentEvents).addFilter(null).build();
// Then
Assert.assertEquals(expectedTimelineSegments, timeline.getTimelineSegments());
}
use of com.navercorp.pinpoint.web.vo.AgentEvent in project pinpoint by naver.
the class AgentEventTimelineTest method noFilter.
@Test
public void noFilter() {
// Given
Range timelineRange = new Range(100, 200);
List<AgentEvent> agentEvents = Arrays.asList(createAgentEvent(140, AgentEventType.AGENT_PING), createAgentEvent(190, AgentEventType.AGENT_PING));
List<AgentEventTimelineSegment> expectedTimelineSegments = Collections.singletonList(createSegment(100, 200, agentEvents));
// When
AgentEventTimeline timeline = new AgentEventTimelineBuilder(timelineRange, 1).from(agentEvents).build();
// Then
Assert.assertEquals(expectedTimelineSegments, timeline.getTimelineSegments());
}
Aggregations