Search in sources :

Example 21 with Range

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

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

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

the class TimeWindowSlotCentricSamplerTest method getWindowSizeFor_1_second.

@Test
public void getWindowSizeFor_1_second() {
    // Given
    final long from = START_TIME_STAMP;
    final long to = START_TIME_STAMP + ONE_SECOND;
    final Range range = new Range(from, to);
    // When
    final long idealWindowSize = sampler.getWindowSize(range);
    // Then
    assertWindowSizeIsIdeal(from, to, idealWindowSize);
}
Also used : Range(com.navercorp.pinpoint.web.vo.Range) Test(org.junit.Test)

Example 24 with Range

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

the class TimeWindowSlotCentricSamplerTest method getWindowSizeFor_3_hours.

@Test
public void getWindowSizeFor_3_hours() {
    // Given
    final long from = START_TIME_STAMP;
    final long to = START_TIME_STAMP + (3 * ONE_HOUR);
    final Range range = new Range(from, to);
    // When
    final long idealWindowSize = sampler.getWindowSize(range);
    // Then
    assertWindowSizeIsIdeal(from, to, idealWindowSize);
}
Also used : Range(com.navercorp.pinpoint.web.vo.Range) Test(org.junit.Test)

Example 25 with Range

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

the class TimeWindowSlotCentricSamplerTest method getWindowSizeEverySecondsFor_5_years.

@Test
public void getWindowSizeEverySecondsFor_5_years() {
    final long numSecondsPerYear = 60 * 60 * 24 * 365;
    for (long periodMs = 0; periodMs <= numSecondsPerYear * 5; periodMs += ONE_SECOND) {
        final long from = START_TIME_STAMP;
        final long to = START_TIME_STAMP + periodMs;
        final Range range = new Range(from, to);
        final long idealWindowSize = sampler.getWindowSize(range);
        assertWindowSizeIsIdeal(from, to, idealWindowSize);
    }
}
Also used : 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