Search in sources :

Example 1 with SampledJvmGc

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

the class HbaseSampledJvmGcDao method getSampledAgentStatList.

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

Example 2 with SampledJvmGc

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

the class LegacyAgentStatChartCompatibilityService method selectAgentStatList.

@Override
public LegacyAgentStatChartGroup selectAgentStatList(String agentId, TimeWindow timeWindow) {
    if (agentId == null) {
        throw new NullPointerException("agentId must not be null");
    }
    if (timeWindow == null) {
        throw new NullPointerException("timeWindow must not be null");
    }
    List<SampledJvmGc> jvmGcs = sampledJvmGcDao.getSampledAgentStatList(agentId, timeWindow);
    if (CollectionUtils.isNotEmpty(jvmGcs)) {
        List<SampledCpuLoad> cpuLoads = sampledCpuLoadDao.getSampledAgentStatList(agentId, timeWindow);
        List<SampledTransaction> transactions = sampledTransactionDao.getSampledAgentStatList(agentId, timeWindow);
        List<SampledActiveTrace> activeTraces = sampledActiveTraceDao.getSampledAgentStatList(agentId, timeWindow);
        LegacyAgentStatChartGroup.LegacyAgentStatChartGroupBuilder builder = new LegacyAgentStatChartGroup.LegacyAgentStatChartGroupBuilder(timeWindow);
        builder.jvmGcs(jvmGcs);
        builder.cpuLoads(cpuLoads);
        builder.transactions(transactions);
        builder.activeTraces(activeTraces);
        return builder.build();
    } else {
        long scanFrom = timeWindow.getWindowRange().getFrom();
        long scanTo = timeWindow.getWindowRange().getTo() + timeWindow.getWindowSlotSize();
        Range rangeToScan = new Range(scanFrom, scanTo);
        List<AgentStat> agentStats = legacyAgentStatDao.getAgentStatList(agentId, rangeToScan);
        LegacyAgentStatChartGroup chartGroup = new LegacyAgentStatChartGroup(timeWindow);
        chartGroup.addAgentStats(agentStats);
        chartGroup.buildCharts();
        return chartGroup;
    }
}
Also used : LegacyAgentStatChartGroup(com.navercorp.pinpoint.web.vo.stat.chart.LegacyAgentStatChartGroup) SampledActiveTrace(com.navercorp.pinpoint.web.vo.stat.SampledActiveTrace) Range(com.navercorp.pinpoint.web.vo.Range) SampledCpuLoad(com.navercorp.pinpoint.web.vo.stat.SampledCpuLoad) SampledTransaction(com.navercorp.pinpoint.web.vo.stat.SampledTransaction) AgentStat(com.navercorp.pinpoint.web.vo.AgentStat) SampledJvmGc(com.navercorp.pinpoint.web.vo.stat.SampledJvmGc)

Example 3 with SampledJvmGc

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

the class JvmGcSampler method sampleDataPoints.

@Override
public SampledJvmGc sampleDataPoints(int timeWindowIndex, long timestamp, List<JvmGcBo> dataPoints, JvmGcBo previousDataPoint) {
    JvmGcType jvmGcType = JvmGcType.UNKNOWN;
    List<Long> heapUseds = new ArrayList<>(dataPoints.size());
    List<Long> heapMaxes = new ArrayList<>(dataPoints.size());
    List<Long> nonHeapUseds = new ArrayList<>(dataPoints.size());
    List<Long> nonHeapMaxes = new ArrayList<>(dataPoints.size());
    List<Long> gcOldCounts = new ArrayList<>(dataPoints.size());
    List<Long> gcOldTimes = new ArrayList<>(dataPoints.size());
    // dataPoints are in descending order
    JvmGcBo previousBo = previousDataPoint;
    for (int i = dataPoints.size() - 1; i >= 0; --i) {
        JvmGcBo jvmGcBo = dataPoints.get(i);
        jvmGcType = jvmGcBo.getGcType();
        if (jvmGcBo.getHeapUsed() != JvmGcBo.UNCOLLECTED_VALUE) {
            heapUseds.add(jvmGcBo.getHeapUsed());
        }
        if (jvmGcBo.getHeapMax() != JvmGcBo.UNCOLLECTED_VALUE) {
            heapMaxes.add(jvmGcBo.getHeapMax());
        }
        if (jvmGcBo.getNonHeapUsed() != JvmGcBo.UNCOLLECTED_VALUE) {
            nonHeapUseds.add(jvmGcBo.getNonHeapUsed());
        }
        if (jvmGcBo.getNonHeapMax() != JvmGcBo.UNCOLLECTED_VALUE) {
            nonHeapMaxes.add(jvmGcBo.getNonHeapMax());
        }
        if (previousBo != null) {
            // Added to maintain backwards compatibility for data that do not have agent start timestamp.
            if (checkJvmRestart(previousBo, jvmGcBo)) {
                if (isGcCollected(jvmGcBo)) {
                    gcOldCounts.add(jvmGcBo.getGcOldCount());
                    gcOldTimes.add(jvmGcBo.getGcOldTime());
                } else {
                    jvmGcBo.setGcOldCount(0L);
                    jvmGcBo.setGcOldTime(0L);
                }
            } else {
                if (isGcCollected(jvmGcBo) && isGcCollected(previousBo)) {
                    gcOldCounts.add(jvmGcBo.getGcOldCount() - previousBo.getGcOldCount());
                    gcOldTimes.add(jvmGcBo.getGcOldTime() - previousBo.getGcOldTime());
                } else {
                    if (!isGcCollected(jvmGcBo)) {
                        jvmGcBo.setGcOldCount(previousBo.getGcOldCount());
                        jvmGcBo.setGcOldTime(previousBo.getGcOldTime());
                    }
                }
            }
        } else {
            if (isGcCollected(jvmGcBo)) {
                if (timeWindowIndex > 0) {
                    gcOldCounts.add(jvmGcBo.getGcOldCount());
                    gcOldTimes.add(jvmGcBo.getGcOldTime());
                } else {
                    gcOldCounts.add(0L);
                    gcOldTimes.add(0L);
                }
            }
        }
        previousBo = jvmGcBo;
    }
    SampledJvmGc sampledJvmGc = new SampledJvmGc();
    sampledJvmGc.setJvmGcType(jvmGcType);
    sampledJvmGc.setHeapUsed(createSampledPoint(timestamp, heapUseds));
    sampledJvmGc.setHeapMax(createSampledPoint(timestamp, heapMaxes));
    sampledJvmGc.setNonHeapUsed(createSampledPoint(timestamp, nonHeapUseds));
    sampledJvmGc.setNonHeapMax(createSampledPoint(timestamp, nonHeapMaxes));
    sampledJvmGc.setGcOldCount(createSampledPoint(timestamp, gcOldCounts));
    sampledJvmGc.setGcOldTime(createSampledPoint(timestamp, gcOldTimes));
    return sampledJvmGc;
}
Also used : JvmGcBo(com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo) ArrayList(java.util.ArrayList) JvmGcType(com.navercorp.pinpoint.common.server.bo.JvmGcType) SampledJvmGc(com.navercorp.pinpoint.web.vo.stat.SampledJvmGc) AgentStatPoint(com.navercorp.pinpoint.web.vo.stat.chart.agent.AgentStatPoint)

Example 4 with SampledJvmGc

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

the class JvmGcSamplerTest method gcCalculation_multipleDataPoints_noPrevious.

@Test
public void gcCalculation_multipleDataPoints_noPrevious() {
    // Given
    long firstGcCount = randomGcCount();
    long firstGcTime = randomGcTime();
    JvmGcBo firstJvmGcBo = createJvmGcBoForGcTest(firstGcCount, firstGcTime);
    long secondGcCount = randomGcCount() + firstGcCount;
    long secondGcTime = randomGcTime() + firstGcTime;
    JvmGcBo secondJvmGcBo = createJvmGcBoForGcTest(secondGcCount, secondGcTime);
    // must be in descending order
    List<JvmGcBo> jvmGcBos = Arrays.asList(secondJvmGcBo, firstJvmGcBo);
    // When
    SampledJvmGc sampledJvmGc = sampler.sampleDataPoints(0, System.currentTimeMillis(), jvmGcBos, null);
    // Then
    long expectedGcCount = secondGcCount - firstGcCount;
    long expectedGcTime = secondGcTime - firstGcTime;
    long actualGcCount = sampledJvmGc.getGcOldCount().getSumYVal();
    long actualGcTime = sampledJvmGc.getGcOldTime().getSumYVal();
    Assert.assertEquals(expectedGcCount, actualGcCount);
    Assert.assertEquals(expectedGcTime, actualGcTime);
}
Also used : JvmGcBo(com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo) SampledJvmGc(com.navercorp.pinpoint.web.vo.stat.SampledJvmGc) Test(org.junit.Test)

Example 5 with SampledJvmGc

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

the class JvmGcSamplerTest method gcCalculation_uncollectedValues.

@Test
public void gcCalculation_uncollectedValues() {
    // Given
    long previousGcCount = randomGcCount();
    long previousGcTime = randomGcTime();
    JvmGcBo previousJvmGcBo = createJvmGcBoForGcTest(previousGcCount, previousGcTime);
    JvmGcBo uncollectedJvmGcBo1 = createJvmGcBoForGcTest(JvmGcBo.UNCOLLECTED_VALUE, JvmGcBo.UNCOLLECTED_VALUE);
    long firstGcCount = randomGcCount() + previousGcCount;
    long firstGcTime = randomGcTime() + previousGcTime;
    JvmGcBo firstJvmGcBo = createJvmGcBoForGcTest(firstGcCount, firstGcTime);
    JvmGcBo uncollectedJvmGcBo2 = createJvmGcBoForGcTest(JvmGcBo.UNCOLLECTED_VALUE, JvmGcBo.UNCOLLECTED_VALUE);
    JvmGcBo uncollectedJvmGcBo3 = createJvmGcBoForGcTest(JvmGcBo.UNCOLLECTED_VALUE, JvmGcBo.UNCOLLECTED_VALUE);
    long secondGcCount = randomGcCount() + firstGcCount;
    long secondGcTime = randomGcTime() + firstGcTime;
    JvmGcBo secondJvmGcBo = createJvmGcBoForGcTest(secondGcCount, secondGcTime);
    // must be in descending order
    List<JvmGcBo> jvmGcBos = Arrays.asList(secondJvmGcBo, uncollectedJvmGcBo3, uncollectedJvmGcBo2, firstJvmGcBo, uncollectedJvmGcBo1);
    // When
    SampledJvmGc sampledJvmGc = sampler.sampleDataPoints(0, System.currentTimeMillis(), jvmGcBos, previousJvmGcBo);
    // Then
    long expectedGcCount = secondGcCount - previousGcCount;
    long expectedGcTime = secondGcTime - previousGcTime;
    long actualGcCount = sampledJvmGc.getGcOldCount().getSumYVal();
    long actualGcTime = sampledJvmGc.getGcOldTime().getSumYVal();
    Assert.assertEquals(expectedGcCount, actualGcCount);
    Assert.assertEquals(expectedGcTime, actualGcTime);
}
Also used : JvmGcBo(com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo) SampledJvmGc(com.navercorp.pinpoint.web.vo.stat.SampledJvmGc) Test(org.junit.Test)

Aggregations

SampledJvmGc (com.navercorp.pinpoint.web.vo.stat.SampledJvmGc)16 JvmGcBo (com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo)15 Test (org.junit.Test)12 Range (com.navercorp.pinpoint.web.vo.Range)3 SampledAgentStatResultExtractor (com.navercorp.pinpoint.web.mapper.stat.SampledAgentStatResultExtractor)2 JvmGcType (com.navercorp.pinpoint.common.server.bo.JvmGcType)1 AgentStat (com.navercorp.pinpoint.web.vo.AgentStat)1 SampledActiveTrace (com.navercorp.pinpoint.web.vo.stat.SampledActiveTrace)1 SampledCpuLoad (com.navercorp.pinpoint.web.vo.stat.SampledCpuLoad)1 SampledTransaction (com.navercorp.pinpoint.web.vo.stat.SampledTransaction)1 LegacyAgentStatChartGroup (com.navercorp.pinpoint.web.vo.stat.chart.LegacyAgentStatChartGroup)1 AgentStatPoint (com.navercorp.pinpoint.web.vo.stat.chart.agent.AgentStatPoint)1 ArrayList (java.util.ArrayList)1