Search in sources :

Example 11 with CpuLoadBo

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

the class CpuLoadCodecV1 method encodeValues.

@Override
public void encodeValues(Buffer valueBuffer, List<CpuLoadBo> cpuLoadBos) {
    if (CollectionUtils.isEmpty(cpuLoadBos)) {
        throw new IllegalArgumentException("cpuLoadBos must not be empty");
    }
    final int numValues = cpuLoadBos.size();
    valueBuffer.putVInt(numValues);
    List<Long> timestamps = new ArrayList<Long>(numValues);
    UnsignedLongEncodingStrategy.Analyzer.Builder jvmCpuLoadAnalyzerBuilder = new UnsignedLongEncodingStrategy.Analyzer.Builder();
    UnsignedLongEncodingStrategy.Analyzer.Builder systemCpuLoadAnalyzerBuilder = new UnsignedLongEncodingStrategy.Analyzer.Builder();
    for (CpuLoadBo cpuLoadBo : cpuLoadBos) {
        timestamps.add(cpuLoadBo.getTimestamp());
        jvmCpuLoadAnalyzerBuilder.addValue(AgentStatUtils.convertDoubleToLong(cpuLoadBo.getJvmCpuLoad()));
        systemCpuLoadAnalyzerBuilder.addValue(AgentStatUtils.convertDoubleToLong(cpuLoadBo.getSystemCpuLoad()));
    }
    this.codec.encodeTimestamps(valueBuffer, timestamps);
    this.encodeDataPoints(valueBuffer, jvmCpuLoadAnalyzerBuilder.build(), systemCpuLoadAnalyzerBuilder.build());
}
Also used : UnsignedLongEncodingStrategy(com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.UnsignedLongEncodingStrategy) CpuLoadBo(com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo) ArrayList(java.util.ArrayList) StrategyAnalyzer(com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.StrategyAnalyzer)

Example 12 with CpuLoadBo

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

the class TestAgentStatFactory method createCpuLoadBos.

public static List<CpuLoadBo> createCpuLoadBos(String agentId, long startTimestamp, long initialTimestamp, int numValues) {
    List<CpuLoadBo> cpuLoadBos = new ArrayList<CpuLoadBo>(numValues);
    List<Long> startTimestamps = createStartTimestamps(startTimestamp, numValues);
    List<Long> timestamps = createTimestamps(initialTimestamp, numValues);
    List<Double> jvmCpuLoads = createRandomPercentageValues(numValues);
    List<Double> systemCpuLoads = createRandomPercentageValues(numValues);
    for (int i = 0; i < numValues; ++i) {
        CpuLoadBo cpuLoadBo = new CpuLoadBo();
        cpuLoadBo.setStartTimestamp(startTimestamps.get(i));
        cpuLoadBo.setAgentId(agentId);
        cpuLoadBo.setTimestamp(timestamps.get(i));
        cpuLoadBo.setJvmCpuLoad(jvmCpuLoads.get(i));
        cpuLoadBo.setSystemCpuLoad(systemCpuLoads.get(i));
        cpuLoadBos.add(cpuLoadBo);
    }
    return cpuLoadBos;
}
Also used : CpuLoadBo(com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo) ArrayList(java.util.ArrayList)

Example 13 with CpuLoadBo

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

the class HbaseSampledCpuLoadDaoV2 method getSampledAgentStatList.

@Override
public List<SampledCpuLoad> getSampledAgentStatList(String agentId, TimeWindow timeWindow) {
    long scanFrom = timeWindow.getWindowRange().getFrom();
    long scanTo = timeWindow.getWindowRange().getTo() + timeWindow.getWindowSlotSize();
    Range range = new Range(scanFrom, scanTo);
    AgentStatMapperV2<CpuLoadBo> mapper = operations.createRowMapper(cpuLoadDecoder, range);
    SampledAgentStatResultExtractor<CpuLoadBo, SampledCpuLoad> resultExtractor = new SampledAgentStatResultExtractor<>(timeWindow, mapper, cpuLoadSampler);
    return operations.getSampledAgentStatList(AgentStatType.CPU_LOAD, resultExtractor, agentId, range);
}
Also used : SampledCpuLoad(com.navercorp.pinpoint.web.vo.stat.SampledCpuLoad) CpuLoadBo(com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo) SampledAgentStatResultExtractor(com.navercorp.pinpoint.web.mapper.stat.SampledAgentStatResultExtractor) Range(com.navercorp.pinpoint.web.vo.Range)

Example 14 with CpuLoadBo

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

the class CpuLoadSampler method sampleDataPoints.

@Override
public SampledCpuLoad sampleDataPoints(int timeWindowIndex, long timestamp, List<CpuLoadBo> dataPoints, CpuLoadBo previousDataPoint) {
    List<Double> jvmCpuLoads = new ArrayList<>(dataPoints.size());
    List<Double> systemCpuLoads = new ArrayList<>(dataPoints.size());
    for (CpuLoadBo cpuLoadBo : dataPoints) {
        if (cpuLoadBo.getJvmCpuLoad() != CpuLoadBo.UNCOLLECTED_VALUE) {
            jvmCpuLoads.add(cpuLoadBo.getJvmCpuLoad() * 100);
        }
        if (cpuLoadBo.getSystemCpuLoad() != CpuLoadBo.UNCOLLECTED_VALUE) {
            systemCpuLoads.add(cpuLoadBo.getSystemCpuLoad() * 100);
        }
    }
    SampledCpuLoad sampledCpuLoad = new SampledCpuLoad();
    sampledCpuLoad.setJvmCpuLoad(createPoint(timestamp, jvmCpuLoads));
    sampledCpuLoad.setSystemCpuLoad(createPoint(timestamp, systemCpuLoads));
    return sampledCpuLoad;
}
Also used : SampledCpuLoad(com.navercorp.pinpoint.web.vo.stat.SampledCpuLoad) CpuLoadBo(com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo) ArrayList(java.util.ArrayList)

Example 15 with CpuLoadBo

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

the class HbaseSampledCpuLoadDao method getSampledAgentStatList.

@Override
public List<SampledCpuLoad> getSampledAgentStatList(String agentId, TimeWindow timeWindow) {
    long scanFrom = timeWindow.getWindowRange().getFrom();
    long scanTo = timeWindow.getWindowRange().getTo() + timeWindow.getWindowSlotSize();
    Range range = new Range(scanFrom, scanTo);
    SampledAgentStatResultExtractor<CpuLoadBo, SampledCpuLoad> resultExtractor = new SampledAgentStatResultExtractor<>(timeWindow, mapper, cpuLoadSampler);
    return operations.getSampledAgentStatList(resultExtractor, agentId, range);
}
Also used : SampledCpuLoad(com.navercorp.pinpoint.web.vo.stat.SampledCpuLoad) CpuLoadBo(com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo) SampledAgentStatResultExtractor(com.navercorp.pinpoint.web.mapper.stat.SampledAgentStatResultExtractor) Range(com.navercorp.pinpoint.web.vo.Range)

Aggregations

CpuLoadBo (com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo)15 ArrayList (java.util.ArrayList)7 JvmGcBo (com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo)6 Range (com.navercorp.pinpoint.web.vo.Range)6 ApplicationIndexDao (com.navercorp.pinpoint.web.dao.ApplicationIndexDao)3 SampledCpuLoad (com.navercorp.pinpoint.web.vo.stat.SampledCpuLoad)3 LinkedList (java.util.LinkedList)3 List (java.util.List)3 BeforeClass (org.junit.BeforeClass)3 AgentStatHeaderDecoder (com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderDecoder)2 BitCountingHeaderDecoder (com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderDecoder)2 StrategyAnalyzer (com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.StrategyAnalyzer)2 UnsignedLongEncodingStrategy (com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.UnsignedLongEncodingStrategy)2 ActiveTraceBo (com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceBo)2 AgentStatBo (com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo)2 DataSourceBo (com.navercorp.pinpoint.common.server.bo.stat.DataSourceBo)2 DataSourceListBo (com.navercorp.pinpoint.common.server.bo.stat.DataSourceListBo)2 JvmGcDetailedBo (com.navercorp.pinpoint.common.server.bo.stat.JvmGcDetailedBo)2 TransactionBo (com.navercorp.pinpoint.common.server.bo.stat.TransactionBo)2 TDataSource (com.navercorp.pinpoint.thrift.dto.TDataSource)2