Search in sources :

Example 1 with AggreJoinCpuLoadBo

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

the class JoinCpuLoadSampler method sampleDataPoints.

@Override
public AggreJoinCpuLoadBo sampleDataPoints(int timeWindowIndex, long timestamp, List<JoinCpuLoadBo> joinCpuLoadBoList, JoinCpuLoadBo previousDataPoint) {
    if (CollectionUtils.isEmpty(joinCpuLoadBoList)) {
        return AggreJoinCpuLoadBo.createUncollectedObject(timestamp);
    }
    JoinCpuLoadBo joinCpuLoadBo = JoinCpuLoadBo.joinCpuLoadBoList(joinCpuLoadBoList, timestamp);
    String id = joinCpuLoadBo.getId();
    final JoinDoubleFieldBo jvmCpuLoadJoinValue = joinCpuLoadBo.getJvmCpuLoadJoinValue();
    double jvmCpuLoad = roundToScale(jvmCpuLoadJoinValue.getAvg() * 100);
    double minJvmCpuLoad = roundToScale(jvmCpuLoadJoinValue.getMin() * 100);
    String minJvmCpuAgentId = jvmCpuLoadJoinValue.getMinAgentId();
    double maxJvmCpuLoad = roundToScale(jvmCpuLoadJoinValue.getMax() * 100);
    String maxJvmCpuAgentId = jvmCpuLoadJoinValue.getMaxAgentId();
    final JoinDoubleFieldBo systemCpuLoadJoinValue = joinCpuLoadBo.getSystemCpuLoadJoinValue();
    double sysCpuLoad = roundToScale(systemCpuLoadJoinValue.getAvg() * 100);
    double minSysCpuLoad = roundToScale(systemCpuLoadJoinValue.getMin() * 100);
    String minSysCpuAgentId = systemCpuLoadJoinValue.getMinAgentId();
    double maxSysCpuLoad = roundToScale(systemCpuLoadJoinValue.getMax() * 100);
    String maxSysCpuAgentId = systemCpuLoadJoinValue.getMaxAgentId();
    AggreJoinCpuLoadBo aggreJoinCpuLoadBo = new AggreJoinCpuLoadBo(id, jvmCpuLoad, maxJvmCpuLoad, maxJvmCpuAgentId, minJvmCpuLoad, minJvmCpuAgentId, sysCpuLoad, maxSysCpuLoad, maxSysCpuAgentId, minSysCpuLoad, minSysCpuAgentId, timestamp);
    return aggreJoinCpuLoadBo;
}
Also used : AggreJoinCpuLoadBo(com.navercorp.pinpoint.web.vo.stat.AggreJoinCpuLoadBo) JoinCpuLoadBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinCpuLoadBo) AggreJoinCpuLoadBo(com.navercorp.pinpoint.web.vo.stat.AggreJoinCpuLoadBo) JoinDoubleFieldBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinDoubleFieldBo)

Example 2 with AggreJoinCpuLoadBo

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

Example 3 with AggreJoinCpuLoadBo

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

the class JoinCpuLoadSamplerTest method sampleDataPoints.

@Test
public void sampleDataPoints() throws Exception {
    JoinCpuLoadSampler joinCpuLoadSampler = new JoinCpuLoadSampler();
    List<JoinCpuLoadBo> joinCpuLoadBoList = new ArrayList<>(5);
    long timeStamp = new Date().getTime();
    joinCpuLoadBoList.add(new JoinCpuLoadBo("testApp", 0.11, 0.60, "agent1_1", 0.20, "agent1_2", 0.1, 0.60, "agent1_3", 0.47, "agent1_4", timeStamp + 5000));
    joinCpuLoadBoList.add(new JoinCpuLoadBo("testApp", 0.22, 0.52, "agent2_1", 0.10, "agent2_2", 0.2, 0.70, "agent2_3", 0.24, "agent2_4", timeStamp + 10000));
    joinCpuLoadBoList.add(new JoinCpuLoadBo("testApp", 0.33, 0.39, "agent3_1", 0.9, "agent3_2", 0.3, 0.85, "agent3_3", 0.33, "agent3_4", timeStamp + 15000));
    joinCpuLoadBoList.add(new JoinCpuLoadBo("testApp", 0.44, 0.42, "agent4_1", 0.25, "agent4_2", 0.4, 0.58, "agent4_3", 0.56, "agent4_4", timeStamp + 20000));
    joinCpuLoadBoList.add(new JoinCpuLoadBo("testApp", 0.55, 0.55, "agent5_1", 0.54, "agent5_2", 0.5, 0.86, "agent5_3", 0.76, "agent5_4", timeStamp + 25000));
    AggreJoinCpuLoadBo aggreJoinCpuLoadBo = joinCpuLoadSampler.sampleDataPoints(0, new Date().getTime(), joinCpuLoadBoList, new JoinCpuLoadBo());
    assertEquals(aggreJoinCpuLoadBo.getId(), "testApp");
    assertEquals(aggreJoinCpuLoadBo.getJvmCpuLoadJoinValue(), new JoinDoubleFieldBo(33.0, 10.0, "agent2_2", 60.0, "agent1_1"));
    assertEquals(aggreJoinCpuLoadBo.getSystemCpuLoadJoinValue(), new JoinDoubleFieldBo(30.0, (double) 24, "agent2_4", 86.0, "agent5_3"));
}
Also used : AggreJoinCpuLoadBo(com.navercorp.pinpoint.web.vo.stat.AggreJoinCpuLoadBo) JoinCpuLoadBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinCpuLoadBo) AggreJoinCpuLoadBo(com.navercorp.pinpoint.web.vo.stat.AggreJoinCpuLoadBo) ArrayList(java.util.ArrayList) JoinDoubleFieldBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinDoubleFieldBo) Date(java.util.Date) Test(org.junit.Test)

Aggregations

AggreJoinCpuLoadBo (com.navercorp.pinpoint.web.vo.stat.AggreJoinCpuLoadBo)3 JoinCpuLoadBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinCpuLoadBo)2 JoinDoubleFieldBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinDoubleFieldBo)2 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 TimeWindow (com.navercorp.pinpoint.web.util.TimeWindow)1 Range (com.navercorp.pinpoint.web.vo.Range)1 Chart (com.navercorp.pinpoint.web.vo.chart.Chart)1 Point (com.navercorp.pinpoint.web.vo.chart.Point)1 StatChartGroup (com.navercorp.pinpoint.web.vo.stat.chart.StatChartGroup)1 Date (java.util.Date)1