Search in sources :

Example 76 with Range

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

the class BFSLinkSelectorTest method testCaller_3tier.

@Test
public void testCaller_3tier() throws Exception {
    // APP_A -> APP_B -> APP_C
    int callCount_A_B = 10;
    LinkDataMap link_A_B = new LinkDataMap();
    link_A_B.addLinkData(APP_A, "agentA", APP_B, "agentB", 1000, BaseHistogramSchema.NORMAL_SCHEMA.getNormalSlot().getSlotTime(), callCount_A_B);
    when(callerDao.selectCaller(eq(APP_A), any(Range.class))).thenReturn(link_A_B);
    LinkDataMap link_B_C = new LinkDataMap();
    int callCount_B_C = 20;
    link_B_C.addLinkData(APP_B, "agentB", APP_C, "agentC", 1000, BaseHistogramSchema.NORMAL_SCHEMA.getNormalSlot().getSlotTime(), callCount_B_C);
    when(callerDao.selectCaller(eq(APP_B), any(Range.class))).thenReturn(link_B_C);
    when(calleeDao.selectCallee(any(Application.class), any(Range.class))).thenReturn(newEmptyLinkDataMap());
    when(hostApplicationMapDao.findAcceptApplicationName(any(Application.class), any(Range.class))).thenReturn(new HashSet<AcceptApplication>());
    // depth 1
    LinkSelector linkSelector = createLinkSelector();
    LinkDataDuplexMap linkData = linkSelector.select(APP_A, range, oneDepth);
    Assert.assertEquals(linkData.size(), 1);
    Assert.assertEquals(linkData.getTotalCount(), callCount_A_B);
    Assert.assertEquals(linkData.getSourceLinkDataList().size(), 1);
    Assert.assertEquals(linkData.getSourceLinkDataMap().getTotalCount(), callCount_A_B);
    assertSource_Target_TotalCount("APP_A->APP_B", linkData, new LinkKey(APP_A, APP_B), callCount_A_B);
    Assert.assertEquals(linkData.getTargetLinkDataList().size(), 0);
    // depth 2
    LinkSelector linkSelector2 = createLinkSelector();
    LinkDataDuplexMap linkData_depth2 = linkSelector2.select(APP_A, range, twoDepth);
    Assert.assertEquals(linkData_depth2.size(), 2);
    Assert.assertEquals(linkData_depth2.getTotalCount(), callCount_A_B + callCount_B_C);
    LinkKey linkKey_A_B = new LinkKey(APP_A, APP_B);
    assertSource_Target_TotalCount("APP_A->APP_B", linkData_depth2, linkKey_A_B, callCount_A_B);
    LinkKey linkKey_B_C = new LinkKey(APP_B, APP_C);
    assertSource_Target_TotalCount("APP_B->APP_C", linkData_depth2, linkKey_B_C, callCount_B_C);
}
Also used : LinkKey(com.navercorp.pinpoint.web.vo.LinkKey) Range(com.navercorp.pinpoint.web.vo.Range) AcceptApplication(com.navercorp.pinpoint.web.service.map.AcceptApplication) Application(com.navercorp.pinpoint.web.vo.Application) AcceptApplication(com.navercorp.pinpoint.web.service.map.AcceptApplication) Test(org.junit.Test)

Example 77 with Range

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

the class DateLimiterTest method checkRange.

@Test
public void checkRange() {
    Limiter limiter = new DateLimiter(2);
    limiter.limit(new Range(0, TimeUnit.DAYS.toMillis(2)));
    long time = 1000;
    limiter.limit(new Range(time, time + TimeUnit.DAYS.toMillis(2)));
    limiter.limit(new Range(TimeUnit.DAYS.toMillis(2), TimeUnit.DAYS.toMillis(2)));
}
Also used : Range(com.navercorp.pinpoint.web.vo.Range) DateLimiter(com.navercorp.pinpoint.web.util.DateLimiter) Limiter(com.navercorp.pinpoint.web.util.Limiter) DateLimiter(com.navercorp.pinpoint.web.util.DateLimiter) Test(org.junit.Test)

Example 78 with Range

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

the class TimeWindowSlotCentricSamplerTest method getWindowSizeFor_5_seconds.

@Test
public void getWindowSizeFor_5_seconds() {
    // Given
    final long from = START_TIME_STAMP;
    final long to = START_TIME_STAMP + (5 * 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 79 with Range

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

the class TimeWindowSlotCentricSamplerTest method getWindowSizeFor_6_hours.

@Test
public void getWindowSizeFor_6_hours() {
    // Given
    final long from = START_TIME_STAMP;
    final long to = START_TIME_STAMP + (6 * 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 80 with Range

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

the class TimeWindowSlotCentricSamplerTest method getWindowSizeFor_1_day.

@Test
public void getWindowSizeFor_1_day() {
    // Given
    final long from = START_TIME_STAMP;
    final long to = START_TIME_STAMP + ONE_DAY;
    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)

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