Search in sources :

Example 11 with AgentEvent

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());
}
Also used : Range(com.navercorp.pinpoint.web.vo.Range) AgentEventFilter(com.navercorp.pinpoint.web.filter.agent.AgentEventFilter) AgentEventType(com.navercorp.pinpoint.common.server.util.AgentEventType) AgentEvent(com.navercorp.pinpoint.web.vo.AgentEvent) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 12 with AgentEvent

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;
}
Also used : AgentEvent(com.navercorp.pinpoint.web.vo.AgentEvent)

Example 13 with AgentEvent

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());
}
Also used : Range(com.navercorp.pinpoint.web.vo.Range) AgentEvent(com.navercorp.pinpoint.web.vo.AgentEvent) Test(org.junit.Test)

Example 14 with AgentEvent

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());
}
Also used : Range(com.navercorp.pinpoint.web.vo.Range) AgentEvent(com.navercorp.pinpoint.web.vo.AgentEvent) Test(org.junit.Test)

Aggregations

AgentEvent (com.navercorp.pinpoint.web.vo.AgentEvent)14 Range (com.navercorp.pinpoint.web.vo.Range)7 Test (org.junit.Test)7 ArrayList (java.util.ArrayList)4 AgentEventBo (com.navercorp.pinpoint.common.server.bo.AgentEventBo)2 AgentEventType (com.navercorp.pinpoint.common.server.util.AgentEventType)2 AgentEventFilter (com.navercorp.pinpoint.web.filter.agent.AgentEventFilter)2 DurationalAgentEvent (com.navercorp.pinpoint.web.vo.DurationalAgentEvent)2 List (java.util.List)2 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 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 PriorityQueue (java.util.PriorityQueue)1 TreeMap (java.util.TreeMap)1