Search in sources :

Example 16 with Range

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

the class AgentEventTimelineTest method leftBiasedSpread.

@Test
public void leftBiasedSpread() {
    // Given
    Range range = new Range(100, 200);
    AgentEvent event1 = createAgentEvent(0, AgentEventType.AGENT_CONNECTED);
    AgentEvent event2 = createAgentEvent(5, AgentEventType.AGENT_PING);
    AgentEvent event3 = createAgentEvent(50, AgentEventType.AGENT_PING);
    AgentEvent event4 = createAgentEvent(100, AgentEventType.AGENT_PING);
    AgentEvent event5 = createAgentEvent(150, AgentEventType.AGENT_PING);
    AgentEvent event6 = createAgentEvent(220, AgentEventType.AGENT_SHUTDOWN);
    List<AgentEventTimelineSegment> expectedTimelineSegments = Arrays.asList(createSegment(100, 101, Arrays.asList(event1, event2, event3, event4)), createSegment(150, 151, Collections.singletonList(event5)), createSegment(199, 200, Collections.singletonList(event6)));
    // When
    AgentEventTimeline timeline = new AgentEventTimelineBuilder(range, 100).from(Arrays.asList(event1, event2, event3, event4, event5, event6)).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 17 with Range

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

the class AgentStatusTimelineTest method nullAgentStatus_nullAgentEvents.

@Test
public void nullAgentStatus_nullAgentEvents() {
    // Given
    Range timelineRange = new Range(0, 100);
    List<AgentStatusTimelineSegment> expectedTimelineSegments = Collections.singletonList(createSegment(0, 100, AgentState.UNKNOWN));
    // When
    AgentStatusTimeline timeline = new AgentStatusTimelineBuilder(timelineRange, null).from(null).build();
    // Then
    Assert.assertEquals(expectedTimelineSegments, timeline.getTimelineSegments());
    Assert.assertFalse(timeline.isIncludeWarning());
}
Also used : Range(com.navercorp.pinpoint.web.vo.Range) Test(org.junit.Test)

Example 18 with Range

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

the class AgentStatusTimelineTest method singleLifeCycle_endedBeforeTimelineEndTimestamp.

@Test
public void singleLifeCycle_endedBeforeTimelineEndTimestamp() {
    // 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;
    AgentStatus initialStatus = createAgentStatus(90, AgentLifeCycleState.RUNNING);
    AgentStatusTimeline timeline = new AgentStatusTimelineBuilder(timelineRange, initialStatus).from(Arrays.asList(createAgentEvent(agentA, 120, AgentEventType.AGENT_PING), createAgentEvent(agentA, 150, AgentEventType.AGENT_PING), createAgentEvent(agentA, 180, AgentEventType.AGENT_SHUTDOWN))).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 19 with Range

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

the class AgentStatusTimelineTest method singleLifeCycle_startedAfterTimelineStartTimestamp_initialStateShutdown.

@Test
public void singleLifeCycle_startedAfterTimelineStartTimestamp_initialStateShutdown() {
    // Given
    Range timelineRange = new Range(100, 200);
    List<AgentStatusTimelineSegment> expectedTimelineSegments = Arrays.asList(createSegment(100, 150, AgentState.SHUTDOWN), createSegment(150, 200, AgentState.RUNNING));
    // When
    long agentA = 150;
    AgentStatus initialStatus = createAgentStatus(50, AgentLifeCycleState.SHUTDOWN);
    AgentStatusTimeline timeline = new AgentStatusTimelineBuilder(timelineRange, initialStatus).from(Arrays.asList(createAgentEvent(agentA, 150, AgentEventType.AGENT_CONNECTED), createAgentEvent(agentA, 180, 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 20 with Range

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

Aggregations

Range (com.navercorp.pinpoint.web.vo.Range)101 Test (org.junit.Test)62 TimeWindow (com.navercorp.pinpoint.web.util.TimeWindow)23 AgentStatus (com.navercorp.pinpoint.web.vo.AgentStatus)16 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)16 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)15 Application (com.navercorp.pinpoint.web.vo.Application)12 SampledAgentStatResultExtractor (com.navercorp.pinpoint.web.mapper.stat.SampledAgentStatResultExtractor)9 List (java.util.List)8 AgentEvent (com.navercorp.pinpoint.web.vo.AgentEvent)7 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)7 CpuLoadBo (com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo)6 JvmGcBo (com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo)6 AgentStatDataPoint (com.navercorp.pinpoint.common.server.bo.stat.AgentStatDataPoint)5 TimeWindowSlotCentricSampler (com.navercorp.pinpoint.web.util.TimeWindowSlotCentricSampler)5 LegacyAgentStatChartGroup (com.navercorp.pinpoint.web.vo.stat.chart.LegacyAgentStatChartGroup)5 ArrayList (java.util.ArrayList)5 TimeWindowSampler (com.navercorp.pinpoint.web.util.TimeWindowSampler)4 StopWatch (org.springframework.util.StopWatch)4 ApplicationIndexDao (com.navercorp.pinpoint.web.dao.ApplicationIndexDao)3