Search in sources :

Example 6 with AgentStatus

use of com.navercorp.pinpoint.web.vo.AgentStatus in project pinpoint by naver.

the class AgentStatusTimelineTest method multipleLifeCycles_overlap3.

@Test
public void multipleLifeCycles_overlap3() {
    // Given
    Range timelineRange = new Range(100, 200);
    List<AgentStatusTimelineSegment> expectedTimelineSegments = Collections.singletonList(createSegment(100, 200, AgentState.RUNNING));
    // When
    long agentA = 80;
    long agentB = 90;
    long agentC = 110;
    AgentStatus initialStatus = createAgentStatus(90, AgentLifeCycleState.RUNNING);
    AgentStatusTimeline timeline = new AgentStatusTimelineBuilder(timelineRange, initialStatus).from(Arrays.asList(createAgentEvent(agentA, 120, AgentEventType.AGENT_PING), createAgentEvent(agentB, 130, AgentEventType.AGENT_PING), createAgentEvent(agentC, 140, AgentEventType.AGENT_PING), createAgentEvent(agentA, 150, AgentEventType.AGENT_PING), createAgentEvent(agentB, 170, AgentEventType.AGENT_SHUTDOWN), createAgentEvent(agentA, 180, AgentEventType.AGENT_PING), createAgentEvent(agentC, 190, AgentEventType.AGENT_SHUTDOWN))).build();
    // Then
    Assert.assertEquals(expectedTimelineSegments, timeline.getTimelineSegments());
    Assert.assertTrue(timeline.isIncludeWarning());
}
Also used : AgentStatus(com.navercorp.pinpoint.web.vo.AgentStatus) Range(com.navercorp.pinpoint.web.vo.Range) Test(org.junit.Test)

Example 7 with AgentStatus

use of com.navercorp.pinpoint.web.vo.AgentStatus in project pinpoint by naver.

the class AgentStatusTimelineTest method singleLifeCycle_startedBeforeTimelineStartTimestamp.

@Test
public void singleLifeCycle_startedBeforeTimelineStartTimestamp() {
    // Given
    Range timelineRange = new Range(100, 200);
    List<AgentStatusTimelineSegment> expectedTimelineSegments = Collections.singletonList(createSegment(100, 200, AgentState.RUNNING));
    // When
    long agentA = 0;
    AgentStatus initialStatus = createAgentStatus(90, AgentLifeCycleState.RUNNING);
    AgentStatusTimeline timeline = new AgentStatusTimelineBuilder(timelineRange, initialStatus).from(Arrays.asList(createAgentEvent(agentA, 140, AgentEventType.AGENT_PING), createAgentEvent(agentA, 190, AgentEventType.AGENT_PING))).build();
    // Then
    Assert.assertEquals(expectedTimelineSegments, timeline.getTimelineSegments());
    Assert.assertFalse(timeline.isIncludeWarning());
}
Also used : AgentStatus(com.navercorp.pinpoint.web.vo.AgentStatus) Range(com.navercorp.pinpoint.web.vo.Range) Test(org.junit.Test)

Example 8 with AgentStatus

use of com.navercorp.pinpoint.web.vo.AgentStatus in project pinpoint by naver.

the class AgentStatusTimelineTest method multipleLifeCycles_overlap.

@Test
public void multipleLifeCycles_overlap() {
    // Given
    Range timelineRange = new Range(100, 200);
    List<AgentStatusTimelineSegment> expectedTimelineSegments = Arrays.asList(createSegment(100, 180, AgentState.RUNNING), createSegment(180, 200, AgentState.SHUTDOWN));
    // When
    long agentA = 0;
    long agentB = 120;
    AgentStatus initialStatus = createAgentStatus(90, AgentLifeCycleState.RUNNING);
    AgentStatusTimeline timeline = new AgentStatusTimelineBuilder(timelineRange, initialStatus).from(Arrays.asList(createAgentEvent(agentB, 120, AgentEventType.AGENT_CONNECTED), createAgentEvent(agentA, 140, AgentEventType.AGENT_PING), createAgentEvent(agentB, 160, AgentEventType.AGENT_UNEXPECTED_SHUTDOWN), createAgentEvent(agentA, 180, AgentEventType.AGENT_SHUTDOWN))).build();
    // Then
    Assert.assertEquals(expectedTimelineSegments, timeline.getTimelineSegments());
    Assert.assertTrue(timeline.isIncludeWarning());
}
Also used : AgentStatus(com.navercorp.pinpoint.web.vo.AgentStatus) Range(com.navercorp.pinpoint.web.vo.Range) Test(org.junit.Test)

Example 9 with AgentStatus

use of com.navercorp.pinpoint.web.vo.AgentStatus in project pinpoint by naver.

the class AgentStatusTimelineTest method multipleLifeCycles_overlap4.

@Test
public void multipleLifeCycles_overlap4() {
    // Given
    Range timelineRange = new Range(100, 200);
    List<AgentStatusTimelineSegment> expectedTimelineSegments = Collections.singletonList(createSegment(100, 200, AgentState.RUNNING));
    // When
    long agentA = 90;
    long agentB = 130;
    long agentC = 160;
    long agentD = 180;
    AgentStatus initialStatus = createAgentStatus(90, AgentLifeCycleState.RUNNING);
    AgentStatusTimeline timeline = new AgentStatusTimelineBuilder(timelineRange, initialStatus).from(Arrays.asList(createAgentEvent(agentA, 120, AgentEventType.AGENT_PING), createAgentEvent(agentB, 130, AgentEventType.AGENT_CONNECTED), createAgentEvent(agentA, 150, AgentEventType.AGENT_SHUTDOWN), createAgentEvent(agentC, 160, AgentEventType.AGENT_CONNECTED), createAgentEvent(agentB, 170, AgentEventType.AGENT_SHUTDOWN), createAgentEvent(agentD, 180, AgentEventType.AGENT_CONNECTED), createAgentEvent(agentC, 190, AgentEventType.AGENT_SHUTDOWN))).build();
    // Then
    Assert.assertEquals(expectedTimelineSegments, timeline.getTimelineSegments());
    Assert.assertTrue(timeline.isIncludeWarning());
}
Also used : AgentStatus(com.navercorp.pinpoint.web.vo.AgentStatus) Range(com.navercorp.pinpoint.web.vo.Range) Test(org.junit.Test)

Example 10 with AgentStatus

use of com.navercorp.pinpoint.web.vo.AgentStatus in project pinpoint by naver.

the class HbaseAgentLifeCycleDao method createAgentStatus.

private AgentStatus createAgentStatus(String agentId, AgentLifeCycleBo agentLifeCycle) {
    if (agentLifeCycle == null) {
        AgentStatus agentStatus = new AgentStatus(agentId);
        agentStatus.setState(AgentLifeCycleState.UNKNOWN);
        return agentStatus;
    } else {
        return new AgentStatus(agentLifeCycle);
    }
}
Also used : AgentStatus(com.navercorp.pinpoint.web.vo.AgentStatus)

Aggregations

AgentStatus (com.navercorp.pinpoint.web.vo.AgentStatus)30 Test (org.junit.Test)21 Range (com.navercorp.pinpoint.web.vo.Range)16 AgentLifeCycleBo (com.navercorp.pinpoint.common.server.bo.AgentLifeCycleBo)7 AgentLifeCycleState (com.navercorp.pinpoint.common.server.util.AgentLifeCycleState)7 AgentInfo (com.navercorp.pinpoint.web.vo.AgentInfo)7 Scan (org.apache.hadoop.hbase.client.Scan)7 ResultsExtractor (com.navercorp.pinpoint.common.hbase.ResultsExtractor)5 TableName (org.apache.hadoop.hbase.TableName)5 HashSet (java.util.HashSet)2 ServiceType (com.navercorp.pinpoint.common.trace.ServiceType)1 AgentTimeHistogram (com.navercorp.pinpoint.web.applicationmap.histogram.AgentTimeHistogram)1 ApplicationTimeHistogram (com.navercorp.pinpoint.web.applicationmap.histogram.ApplicationTimeHistogram)1 Histogram (com.navercorp.pinpoint.web.applicationmap.histogram.Histogram)1 NodeHistogram (com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram)1 LinkInfo (com.navercorp.pinpoint.web.applicationmap.link.LinkInfo)1 MatcherGroup (com.navercorp.pinpoint.web.applicationmap.link.MatcherGroup)1 AgentHistogram (com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram)1 AgentEventFilter (com.navercorp.pinpoint.web.filter.agent.AgentEventFilter)1 AgentEvent (com.navercorp.pinpoint.web.vo.AgentEvent)1