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);
}
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;
}
}
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;
}
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);
}
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);
}
Aggregations