Search in sources :

Example 1 with JoinCpuLoadBo

use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinCpuLoadBo 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 JoinCpuLoadBo

use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinCpuLoadBo in project pinpoint by naver.

the class TBaseFlatMapperTest method assertJoinCpuLoadBo.

private void assertJoinCpuLoadBo(List<JoinCpuLoadBo> joincpulaodBoList) {
    assertEquals(2, joincpulaodBoList.size());
    JoinCpuLoadBo joinCpuLoadBo = joincpulaodBoList.get(0);
    assertEquals(joinCpuLoadBo.getId(), AGENT_ID);
    assertEquals(joinCpuLoadBo.getTimestamp(), 1491274143454L);
    JoinDoubleFieldBo jvmCpuLoadJoinValue = joinCpuLoadBo.getJvmCpuLoadJoinValue();
    assertEquals(jvmCpuLoadJoinValue.getAvg(), 10, 0);
    assertEquals(jvmCpuLoadJoinValue.getMin(), 10, 0);
    assertEquals(jvmCpuLoadJoinValue.getMax(), 10, 0);
    JoinDoubleFieldBo systemCpuLoadJoinValue = joinCpuLoadBo.getSystemCpuLoadJoinValue();
    assertEquals(systemCpuLoadJoinValue.getAvg(), 30, 0);
    assertEquals(systemCpuLoadJoinValue.getMin(), 30, 0);
    assertEquals(systemCpuLoadJoinValue.getMax(), 30, 0);
    joinCpuLoadBo = joincpulaodBoList.get(1);
    assertEquals(joinCpuLoadBo.getId(), AGENT_ID);
    assertEquals(joinCpuLoadBo.getTimestamp(), 1491274148454L);
    jvmCpuLoadJoinValue = joinCpuLoadBo.getJvmCpuLoadJoinValue();
    assertEquals(jvmCpuLoadJoinValue.getAvg(), 20, 0);
    assertEquals(jvmCpuLoadJoinValue.getMin(), 20, 0);
    assertEquals(jvmCpuLoadJoinValue.getMax(), 20, 0);
    systemCpuLoadJoinValue = joinCpuLoadBo.getSystemCpuLoadJoinValue();
    assertEquals(systemCpuLoadJoinValue.getAvg(), 50, 0);
    assertEquals(systemCpuLoadJoinValue.getMin(), 50, 0);
    assertEquals(systemCpuLoadJoinValue.getMax(), 50, 0);
}
Also used : JoinCpuLoadBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinCpuLoadBo) JoinDoubleFieldBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinDoubleFieldBo)

Example 3 with JoinCpuLoadBo

use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinCpuLoadBo in project pinpoint by naver.

the class JoinThriftCpuLoadBoMapperTest method map2Test.

@Test
public void map2Test() {
    final TFAgentStat tFAgentStat = new TFAgentStat();
    tFAgentStat.setAgentId("testAgent");
    tFAgentStat.setTimestamp(1491274138454L);
    final JoinCpuLoadBoMapper mapper = new JoinCpuLoadBoMapper();
    final JoinCpuLoadBo joinCpuLoadBo = mapper.map(tFAgentStat);
    assertEquals(joinCpuLoadBo, joinCpuLoadBo.EMPTY_JOIN_CPU_LOAD_BO);
}
Also used : JoinCpuLoadBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinCpuLoadBo) TFAgentStat(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat) Test(org.junit.Test)

Example 4 with JoinCpuLoadBo

use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinCpuLoadBo in project pinpoint by naver.

the class CpuLoadCodecTest method createJoinCpuLoadBoList.

private List<JoinStatBo> createJoinCpuLoadBoList(long currentTime) {
    final String id = "test_app";
    final List<JoinStatBo> joinCpuLoadBoList = new ArrayList<>();
    JoinCpuLoadBo joinCpuLoadBo1 = new JoinCpuLoadBo(id, 50, 97, "agent1_1", 27, "agent1_2", 80, 97, "agent1_3", 46, "agent1_4", currentTime);
    JoinCpuLoadBo joinCpuLoadBo2 = new JoinCpuLoadBo(id, 40, 87, "agent2_1", 40, "agent2_2", 70, 97, "agent2_3", 40, "agent2_4", currentTime + 5000);
    JoinCpuLoadBo joinCpuLoadBo4 = new JoinCpuLoadBo(id, 20, 67, "agent4_1", 17, "agent4_2", 40, 99, "agent4_3", 18, "agent4_4", currentTime + 15000);
    JoinCpuLoadBo joinCpuLoadBo3 = new JoinCpuLoadBo(id, 30, 77, "agent3_1", 27, "agent3_2", 60, 77, "agent3_3", 27, "agent3_4", currentTime + 10000);
    JoinCpuLoadBo joinCpuLoadBo5 = new JoinCpuLoadBo(id, 10, 99, "agent5_1", 7, "agent5_2", 30, 59, "agent5_3", 8, "agent5_4", currentTime + 20000);
    joinCpuLoadBoList.add(joinCpuLoadBo1);
    joinCpuLoadBoList.add(joinCpuLoadBo2);
    joinCpuLoadBoList.add(joinCpuLoadBo3);
    joinCpuLoadBoList.add(joinCpuLoadBo4);
    joinCpuLoadBoList.add(joinCpuLoadBo5);
    return joinCpuLoadBoList;
}
Also used : JoinCpuLoadBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinCpuLoadBo) ArrayList(java.util.ArrayList) JoinStatBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo)

Example 5 with JoinCpuLoadBo

use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinCpuLoadBo 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

JoinCpuLoadBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinCpuLoadBo)11 JoinDoubleFieldBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinDoubleFieldBo)6 ArrayList (java.util.ArrayList)5 Test (org.junit.Test)4 JoinStatBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo)3 TFAgentStat (com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat)3 TFCpuLoad (com.navercorp.pinpoint.thrift.dto.flink.TFCpuLoad)3 AggreJoinCpuLoadBo (com.navercorp.pinpoint.web.vo.stat.AggreJoinCpuLoadBo)2 AgentStatHeaderDecoder (com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderDecoder)1 BitCountingHeaderDecoder (com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderDecoder)1 JoinLongFieldEncodingStrategy (com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinLongFieldEncodingStrategy)1 JoinLongFieldStrategyAnalyzer (com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinLongFieldStrategyAnalyzer)1 JoinAgentStatBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo)1 JoinLongFieldBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo)1 TFAgentStatBatch (com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch)1 Date (java.util.Date)1