Search in sources :

Example 16 with TimeWindow

use of com.navercorp.pinpoint.web.util.TimeWindow in project pinpoint by naver.

the class ApplicationTotalThreadCountChartGroupTest method createApplicationTotalThreadCountChartGroupTest.

@Test
public void createApplicationTotalThreadCountChartGroupTest() {
    long time = 1495418083250L;
    Range range = Range.newRange(time - 240000, time);
    TimeWindow timeWindow = new TimeWindow(range);
    List<AggreJoinTotalThreadCountBo> aggreJoinTotalThreadCountBoList = new ArrayList<>(5);
    AggreJoinTotalThreadCountBo aggreJoinFileDescriptorBo1 = new AggreJoinTotalThreadCountBo("testApp", time, 11, 20, "agent1_1", 60, "agent1_2");
    AggreJoinTotalThreadCountBo aggreJoinFileDescriptorBo2 = new AggreJoinTotalThreadCountBo("testApp", time - 60000, 22, 10, "agent2_1", 52, "agent2_2");
    AggreJoinTotalThreadCountBo aggreJoinFileDescriptorBo3 = new AggreJoinTotalThreadCountBo("testApp", time - 120000, 33, 9, "agent3_1", 39, "agent3_2");
    AggreJoinTotalThreadCountBo aggreJoinFileDescriptorBo4 = new AggreJoinTotalThreadCountBo("testApp", time - 180000, 44, 25, "agent4_1", 42, "agent4_2");
    AggreJoinTotalThreadCountBo aggreJoinFileDescriptorBo5 = new AggreJoinTotalThreadCountBo("testApp", time - 240000, 55, 54, "agent5_1", 55, "agent5_2");
    aggreJoinTotalThreadCountBoList.add(aggreJoinFileDescriptorBo1);
    aggreJoinTotalThreadCountBoList.add(aggreJoinFileDescriptorBo2);
    aggreJoinTotalThreadCountBoList.add(aggreJoinFileDescriptorBo3);
    aggreJoinTotalThreadCountBoList.add(aggreJoinFileDescriptorBo4);
    aggreJoinTotalThreadCountBoList.add(aggreJoinFileDescriptorBo5);
    StatChartGroup applicationTotalThreadCountChartGroup = new ApplicationTotalThreadCountChart.ApplicationTotalThreadCountChartGroup(timeWindow, aggreJoinTotalThreadCountBoList);
    Map<StatChartGroup.ChartType, Chart<? extends Point>> charts = applicationTotalThreadCountChartGroup.getCharts();
    assertEquals(1, charts.size());
    Chart totalThreadCountChart = charts.get(ApplicationTotalThreadCountChart.ApplicationTotalThreadCountChartGroup.TotalThreadCountChartType.TOTAL_THREAD_COUNT);
    List<Point> totalThreadCountChartPoints = totalThreadCountChart.getPoints();
    assertEquals(5, totalThreadCountChartPoints.size());
    int index = totalThreadCountChartPoints.size();
    for (Point point : totalThreadCountChartPoints) {
        testTotalThreadCount((LongApplicationStatPoint) point, aggreJoinTotalThreadCountBoList.get(--index));
    }
}
Also used : AggreJoinTotalThreadCountBo(com.navercorp.pinpoint.web.vo.stat.AggreJoinTotalThreadCountBo) ArrayList(java.util.ArrayList) Point(com.navercorp.pinpoint.web.vo.chart.Point) Range(com.navercorp.pinpoint.web.vo.Range) TimeWindow(com.navercorp.pinpoint.web.util.TimeWindow) Point(com.navercorp.pinpoint.web.vo.chart.Point) StatChartGroup(com.navercorp.pinpoint.web.vo.stat.chart.StatChartGroup) Chart(com.navercorp.pinpoint.web.vo.chart.Chart) Test(org.junit.Test)

Example 17 with TimeWindow

use of com.navercorp.pinpoint.web.util.TimeWindow in project pinpoint by naver.

the class DataSourceChartSerializerTest method serializeTest.

@Test
public void serializeTest() throws Exception {
    long currentTimeMillis = System.currentTimeMillis();
    TimeWindow timeWindow = new TimeWindow(Range.newRange(currentTimeMillis - 300000, currentTimeMillis));
    List<SampledDataSource> sampledDataSourceList = createSampledDataSourceList(timeWindow);
    DataSourceChart dataSourceChartGroup = new DataSourceChart(timeWindow, sampledDataSourceList, serviceTypeRegistryService);
    String jsonValue = mapper.writeValueAsString(dataSourceChartGroup);
    Map<?, ?> map = mapper.readValue(jsonValue, Map.class);
    Assert.assertTrue(map.containsKey("id"));
    Assert.assertTrue(map.containsKey("jdbcUrl"));
    Assert.assertTrue(map.containsKey("databaseName"));
    Assert.assertTrue(map.containsKey("serviceType"));
    Assert.assertTrue(map.containsKey("charts"));
}
Also used : SampledDataSource(com.navercorp.pinpoint.web.vo.stat.SampledDataSource) DataSourceChart(com.navercorp.pinpoint.web.vo.stat.chart.agent.DataSourceChart) TimeWindow(com.navercorp.pinpoint.web.util.TimeWindow) Test(org.junit.Test)

Example 18 with TimeWindow

use of com.navercorp.pinpoint.web.util.TimeWindow in project pinpoint by naver.

the class ApplicationLoadedClassChartGroupTest method createApplicationLoadedClassChartGroupTest.

@Test
public void createApplicationLoadedClassChartGroupTest() {
    long time = 1495418083250L;
    Range range = Range.newRange(time - 240000, time);
    TimeWindow timeWindow = new TimeWindow(range);
    List<AggreJoinLoadedClassBo> aggreJoinLoadedClassBoList = new ArrayList<>(5);
    AggreJoinLoadedClassBo aggreJoinLoadedClassBo1 = new AggreJoinLoadedClassBo("testApp", 11, 20, "agent1_1", 60, "agent1_2", 11, 20, "agent1_1", 60, "agent1_2", time);
    AggreJoinLoadedClassBo aggreJoinLoadedClassBo2 = new AggreJoinLoadedClassBo("testApp", 22, 10, "agent2_1", 52, "agent2_2", 22, 10, "agent2_1", 52, "agent2_2", time - 60000);
    AggreJoinLoadedClassBo aggreJoinLoadedClassBo3 = new AggreJoinLoadedClassBo("testApp", 33, 9, "agent3_1", 39, "agent3_2", 33, 9, "agent3_1", 39, "agent3_2", time - 120000);
    AggreJoinLoadedClassBo aggreJoinLoadedClassBo4 = new AggreJoinLoadedClassBo("testApp", 44, 25, "agent4_1", 42, "agent4_2", 44, 25, "agent4_1", 42, "agent4_2", time - 180000);
    AggreJoinLoadedClassBo aggreJoinLoadedClassBo5 = new AggreJoinLoadedClassBo("testApp", 55, 54, "agent5_1", 55, "agent5_2", 55, 54, "agent5_1", 55, "agent5_2", time - 240000);
    aggreJoinLoadedClassBoList.add(aggreJoinLoadedClassBo1);
    aggreJoinLoadedClassBoList.add(aggreJoinLoadedClassBo2);
    aggreJoinLoadedClassBoList.add(aggreJoinLoadedClassBo3);
    aggreJoinLoadedClassBoList.add(aggreJoinLoadedClassBo4);
    aggreJoinLoadedClassBoList.add(aggreJoinLoadedClassBo5);
    StatChartGroup applicationLoadedCLassChartGroup = new ApplicationLoadedClassChart.ApplicationLoadedClassChartGroup(timeWindow, aggreJoinLoadedClassBoList);
    Map<StatChartGroup.ChartType, Chart<? extends Point>> charts = applicationLoadedCLassChartGroup.getCharts();
    assertEquals(2, charts.size());
    Chart loadedClassChart = charts.get(ApplicationLoadedClassChart.ApplicationLoadedClassChartGroup.LoadedClassChartType.LOADED_CLASS_COUNT);
    List<Point> loadedClassChartPoints = loadedClassChart.getPoints();
    assertEquals(5, loadedClassChartPoints.size());
    int index = loadedClassChartPoints.size();
    for (Point point : loadedClassChartPoints) {
        testLoadedCLass((LongApplicationStatPoint) point, aggreJoinLoadedClassBoList.get(--index));
    }
    Chart unloadedClassChart = charts.get(ApplicationLoadedClassChart.ApplicationLoadedClassChartGroup.LoadedClassChartType.UNLOADED_CLASS_COUNT);
    List<Point> unloadedClassChartPoints = unloadedClassChart.getPoints();
    assertEquals(5, unloadedClassChartPoints.size());
    index = unloadedClassChartPoints.size();
    for (Point point : unloadedClassChartPoints) {
        testUnloadedCLass((LongApplicationStatPoint) point, aggreJoinLoadedClassBoList.get(--index));
    }
}
Also used : AggreJoinLoadedClassBo(com.navercorp.pinpoint.web.vo.stat.AggreJoinLoadedClassBo) ArrayList(java.util.ArrayList) Point(com.navercorp.pinpoint.web.vo.chart.Point) Range(com.navercorp.pinpoint.web.vo.Range) TimeWindow(com.navercorp.pinpoint.web.util.TimeWindow) Point(com.navercorp.pinpoint.web.vo.chart.Point) StatChartGroup(com.navercorp.pinpoint.web.vo.stat.chart.StatChartGroup) Chart(com.navercorp.pinpoint.web.vo.chart.Chart) Test(org.junit.Test)

Example 19 with TimeWindow

use of com.navercorp.pinpoint.web.util.TimeWindow in project pinpoint by naver.

the class ApplicationActiveTraceChartGroupTest method createApplicationActiveTraceChartGroupTest.

@Test
public void createApplicationActiveTraceChartGroupTest() {
    long time = 1495418083250L;
    String id = "testApp";
    Range range = Range.newRange(time - 240000, time);
    TimeWindow timeWindow = new TimeWindow(range);
    List<AggreJoinActiveTraceBo> aggreJoinActiveTraceBoList = new ArrayList<>(5);
    AggreJoinActiveTraceBo aggreJoinActiveTraceBo1 = new AggreJoinActiveTraceBo(id, 1, (short) 2, 150, 10, "app_1_1", 230, "app_1_2", time);
    AggreJoinActiveTraceBo aggreJoinActiveTraceBo2 = new AggreJoinActiveTraceBo(id, 1, (short) 2, 110, 22, "app_2_1", 330, "app_2_2", time - 60000);
    AggreJoinActiveTraceBo aggreJoinActiveTraceBo3 = new AggreJoinActiveTraceBo(id, 1, (short) 2, 120, 24, "app_3_1", 540, "app_3_2", time - 120000);
    AggreJoinActiveTraceBo aggreJoinActiveTraceBo4 = new AggreJoinActiveTraceBo(id, 1, (short) 2, 130, 25, "app_4_1", 560, "app_4_2", time - 180000);
    AggreJoinActiveTraceBo aggreJoinActiveTraceBo5 = new AggreJoinActiveTraceBo(id, 1, (short) 2, 140, 12, "app_5_1", 260, "app_5_2", time - 240000);
    aggreJoinActiveTraceBoList.add(aggreJoinActiveTraceBo1);
    aggreJoinActiveTraceBoList.add(aggreJoinActiveTraceBo2);
    aggreJoinActiveTraceBoList.add(aggreJoinActiveTraceBo3);
    aggreJoinActiveTraceBoList.add(aggreJoinActiveTraceBo4);
    aggreJoinActiveTraceBoList.add(aggreJoinActiveTraceBo5);
    StatChartGroup applicationActiveTraceChartGroup = new ApplicationActiveTraceChart.ApplicationActiveTraceChartGroup(timeWindow, aggreJoinActiveTraceBoList);
    Map<StatChartGroup.ChartType, Chart<? extends Point>> charts = applicationActiveTraceChartGroup.getCharts();
    Chart<? extends Point> activeTraceChart = charts.get(ApplicationActiveTraceChart.ApplicationActiveTraceChartGroup.ActiveTraceChartType.ACTIVE_TRACE_COUNT);
    List<? extends Point> activeTracePointList = activeTraceChart.getPoints();
    assertEquals(5, activeTracePointList.size());
    int index = activeTracePointList.size();
    for (Point point : activeTracePointList) {
        testActiveTraceCount((IntApplicationStatPoint) point, aggreJoinActiveTraceBoList.get(--index));
    }
}
Also used : ArrayList(java.util.ArrayList) Point(com.navercorp.pinpoint.web.vo.chart.Point) Range(com.navercorp.pinpoint.web.vo.Range) TimeWindow(com.navercorp.pinpoint.web.util.TimeWindow) Point(com.navercorp.pinpoint.web.vo.chart.Point) AggreJoinActiveTraceBo(com.navercorp.pinpoint.web.vo.stat.AggreJoinActiveTraceBo) StatChartGroup(com.navercorp.pinpoint.web.vo.stat.chart.StatChartGroup) Chart(com.navercorp.pinpoint.web.vo.chart.Chart) Test(org.junit.Test)

Example 20 with TimeWindow

use of com.navercorp.pinpoint.web.util.TimeWindow in project pinpoint by naver.

the class ApplicationCpuLoadChartGroupTest method createApplicationCpuLoadChartGroupTest.

@Test
public void createApplicationCpuLoadChartGroupTest() {
    long time = 1495418083250L;
    Range range = Range.newRange(time - 240000, time);
    TimeWindow timeWindow = new TimeWindow(range);
    List<AggreJoinCpuLoadBo> aggreCpuLoadList = new ArrayList<>(5);
    AggreJoinCpuLoadBo aggreJoinCpuLoadBo1 = new AggreJoinCpuLoadBo("testApp", 0.11, 0.60, "agent1_1", 0.20, "agent1_2", 0.1, 0.60, "agent1_3", 0.47, "agent1_4", time);
    AggreJoinCpuLoadBo aggreJoinCpuLoadBo2 = new AggreJoinCpuLoadBo("testApp", 0.22, 0.52, "agent2_1", 0.10, "agent2_2", 0.2, 0.70, "agent2_3", 0.24, "agent2_4", time - 60000);
    AggreJoinCpuLoadBo aggreJoinCpuLoadBo3 = new AggreJoinCpuLoadBo("testApp", 0.33, 0.39, "agent3_1", 0.9, "agent3_2", 0.3, 0.85, "agent3_3", 0.33, "agent3_4", time - 120000);
    AggreJoinCpuLoadBo aggreJoinCpuLoadBo4 = new AggreJoinCpuLoadBo("testApp", 0.44, 0.42, "agent4_1", 0.25, "agent4_2", 0.4, 0.58, "agent4_3", 0.56, "agent4_4", time - 180000);
    AggreJoinCpuLoadBo aggreJoinCpuLoadBo5 = new AggreJoinCpuLoadBo("testApp", 0.55, 0.55, "agent5_1", 0.54, "agent5_2", 0.5, 0.86, "agent5_3", 0.76, "agent5_4", time - 240000);
    aggreCpuLoadList.add(aggreJoinCpuLoadBo1);
    aggreCpuLoadList.add(aggreJoinCpuLoadBo2);
    aggreCpuLoadList.add(aggreJoinCpuLoadBo3);
    aggreCpuLoadList.add(aggreJoinCpuLoadBo4);
    aggreCpuLoadList.add(aggreJoinCpuLoadBo5);
    StatChartGroup applicationCpuLoadChartGroup = new ApplicationCpuLoadChart.ApplicationCpuLoadChartGroup(timeWindow, aggreCpuLoadList);
    Map<StatChartGroup.ChartType, Chart<? extends Point>> charts = applicationCpuLoadChartGroup.getCharts();
    assertEquals(2, charts.size());
    Chart jvmCpuLodChart = charts.get(ApplicationCpuLoadChart.ApplicationCpuLoadChartGroup.CpuLoadChartType.CPU_LOAD_JVM);
    List<Point> jvmCpuLoadPoints = jvmCpuLodChart.getPoints();
    assertEquals(5, jvmCpuLoadPoints.size());
    int index = jvmCpuLoadPoints.size();
    for (Point point : jvmCpuLoadPoints) {
        testJvmCpuLoad((DoubleApplicationStatPoint) point, aggreCpuLoadList.get(--index));
    }
    Chart sysCpuLoadChart = charts.get(ApplicationCpuLoadChart.ApplicationCpuLoadChartGroup.CpuLoadChartType.CPU_LOAD_SYSTEM);
    List<Point> sysCpuLoadPoints = sysCpuLoadChart.getPoints();
    assertEquals(5, sysCpuLoadPoints.size());
    index = sysCpuLoadPoints.size();
    for (Point point : sysCpuLoadPoints) {
        testSysCpuLoad((DoubleApplicationStatPoint) point, aggreCpuLoadList.get(--index));
    }
}
Also used : ArrayList(java.util.ArrayList) Point(com.navercorp.pinpoint.web.vo.chart.Point) Range(com.navercorp.pinpoint.web.vo.Range) TimeWindow(com.navercorp.pinpoint.web.util.TimeWindow) Point(com.navercorp.pinpoint.web.vo.chart.Point) StatChartGroup(com.navercorp.pinpoint.web.vo.stat.chart.StatChartGroup) AggreJoinCpuLoadBo(com.navercorp.pinpoint.web.vo.stat.AggreJoinCpuLoadBo) Chart(com.navercorp.pinpoint.web.vo.chart.Chart) Test(org.junit.Test)

Aggregations

TimeWindow (com.navercorp.pinpoint.web.util.TimeWindow)42 Test (org.junit.Test)26 Range (com.navercorp.pinpoint.web.vo.Range)25 ArrayList (java.util.ArrayList)14 StatChartGroup (com.navercorp.pinpoint.web.vo.stat.chart.StatChartGroup)13 Chart (com.navercorp.pinpoint.web.vo.chart.Chart)12 Point (com.navercorp.pinpoint.web.vo.chart.Point)12 TimeWindowSampler (com.navercorp.pinpoint.web.util.TimeWindowSampler)8 TimeWindowSlotCentricSampler (com.navercorp.pinpoint.web.util.TimeWindowSlotCentricSampler)8 AgentStatDataPoint (com.navercorp.pinpoint.common.server.bo.stat.AgentStatDataPoint)7 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)7 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)7 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)7 SampledDataSource (com.navercorp.pinpoint.web.vo.stat.SampledDataSource)6 GetMapping (org.springframework.web.bind.annotation.GetMapping)5 List (java.util.List)4 LinkDataMap (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataMap)3 SampledAgentStatDataPoint (com.navercorp.pinpoint.web.vo.stat.SampledAgentStatDataPoint)3 LegacyAgentStatChartGroup (com.navercorp.pinpoint.web.vo.stat.chart.LegacyAgentStatChartGroup)3 StopWatch (org.springframework.util.StopWatch)3