use of com.navercorp.pinpoint.web.vo.AgentStat in project pinpoint by naver.
the class LegacyAgentStatMapper method readAgentStatThriftDto.
// FIXME (2014.08) Legacy support for TAgentStat Thrift DTO stored directly into hbase.
@Deprecated
private List<AgentStat> readAgentStatThriftDto(String agentId, long timestamp, byte[] tAgentStatByteArray) throws TException {
// CompactProtocol used
TDeserializer deserializer = new TDeserializer(factory);
TAgentStat tAgentStat = new TAgentStat();
deserializer.deserialize(tAgentStat, tAgentStatByteArray);
TJvmGc gc = tAgentStat.getGc();
if (gc == null) {
return Collections.emptyList();
}
AgentStatMemoryGcBo.Builder memoryGcBoBuilder = new AgentStatMemoryGcBo.Builder(tAgentStat.getAgentId(), tAgentStat.getStartTimestamp(), tAgentStat.getTimestamp());
memoryGcBoBuilder.gcType(gc.getType().name());
memoryGcBoBuilder.jvmMemoryHeapUsed(gc.getJvmMemoryHeapUsed());
memoryGcBoBuilder.jvmMemoryHeapMax(gc.getJvmMemoryHeapMax());
memoryGcBoBuilder.jvmMemoryNonHeapUsed(gc.getJvmMemoryNonHeapUsed());
memoryGcBoBuilder.jvmMemoryNonHeapMax(gc.getJvmMemoryNonHeapMax());
memoryGcBoBuilder.jvmGcOldCount(gc.getJvmGcOldCount());
memoryGcBoBuilder.jvmGcOldTime(gc.getJvmGcOldTime());
AgentStat agentStat = new AgentStat(agentId, timestamp);
AgentStatMemoryGcBo agentStatMemoryGcBo = memoryGcBoBuilder.build();
agentStat.setGcType(agentStatMemoryGcBo.getGcType());
agentStat.setGcOldCount(agentStatMemoryGcBo.getJvmGcOldCount());
agentStat.setGcOldTime(agentStatMemoryGcBo.getJvmGcOldTime());
agentStat.setHeapUsed(agentStatMemoryGcBo.getJvmMemoryHeapUsed());
agentStat.setHeapMax(agentStatMemoryGcBo.getJvmMemoryHeapMax());
agentStat.setNonHeapUsed(agentStatMemoryGcBo.getJvmMemoryNonHeapUsed());
agentStat.setNonHeapMax(agentStatMemoryGcBo.getJvmMemoryNonHeapMax());
List<AgentStat> result = new ArrayList<>(1);
result.add(agentStat);
return result;
}
use of com.navercorp.pinpoint.web.vo.AgentStat in project pinpoint by naver.
the class LegacyAgentStatMapperTest method test_legacy_column_storage.
@Test
public void test_legacy_column_storage() throws Exception {
// Given
final Result result = Result.create(Arrays.asList(createCell(AGENT_STAT_COL_INTERVAL, Bytes.toBytes(COLLECT_INTERVAL)), createCell(AGENT_STAT_COL_GC_TYPE, Bytes.toBytes(GC_TYPE.name())), createCell(AGENT_STAT_COL_GC_OLD_COUNT, Bytes.toBytes(GC_OLD_COUNT)), createCell(AGENT_STAT_COL_GC_OLD_TIME, Bytes.toBytes(GC_OLD_TIME)), createCell(AGENT_STAT_COL_HEAP_USED, Bytes.toBytes(HEAP_USED)), createCell(AGENT_STAT_COL_HEAP_MAX, Bytes.toBytes(HEAP_MAX)), createCell(AGENT_STAT_COL_NON_HEAP_USED, Bytes.toBytes(NON_HEAP_USED)), createCell(AGENT_STAT_COL_NON_HEAP_MAX, Bytes.toBytes(NON_HEAP_MAX)), createCell(AGENT_STAT_COL_JVM_CPU, Bytes.toBytes(JVM_CPU_USAGE)), createCell(AGENT_STAT_COL_SYS_CPU, Bytes.toBytes(SYS_CPU_USAGE)), createCell(AGENT_STAT_COL_TRANSACTION_SAMPLED_NEW, Bytes.toBytes(SAMPLED_NEW_COUNT)), createCell(AGENT_STAT_COL_TRANSACTION_SAMPLED_CONTINUATION, Bytes.toBytes(SAMPLED_CONTINUATION_COUNT)), createCell(AGENT_STAT_COL_TRANSACTION_UNSAMPLED_NEW, Bytes.toBytes(UNSAMPLED_NEW_COUNT)), createCell(AGENT_STAT_COL_TRANSACTION_UNSAMPLED_CONTINUATION, Bytes.toBytes(UNSAMPLED_CONTINUATION_COUNT))));
// When
List<AgentStat> agentStats = this.mapper.mapRow(result, 0);
// Then
assertNotNull(agentStats);
assertThat(agentStats.size(), is(1));
AgentStat agentStat = agentStats.get(0);
assertEquals(COLLECT_INTERVAL, agentStat.getCollectInterval());
assertJvmGc(agentStat);
assertCpuUsage(agentStat);
assertTransaction(agentStat);
}
use of com.navercorp.pinpoint.web.vo.AgentStat in project pinpoint by naver.
the class LegacyAgentStatMapperTest method test_legacy_with_AGENT_STAT_CF_STATISTICS_V1.
@Test
public void test_legacy_with_AGENT_STAT_CF_STATISTICS_V1() throws Exception {
// Given
final Result result = createResultForLegacyWith_AGENT_STAT_CF_STATISTICS_V1();
// When
List<AgentStat> agentStats = this.mapper.mapRow(result, 0);
// Then
assertNotNull(agentStats);
assertThat(agentStats.size(), is(1));
AgentStat agentStat = agentStats.get(0);
assertEquals(0, agentStat.getCollectInterval());
assertJvmGc(agentStat);
assertEquals(AgentStat.NOT_COLLECTED, agentStat.getJvmCpuUsage(), DELTA);
assertEquals(AgentStat.NOT_COLLECTED, agentStat.getSystemCpuUsage(), DELTA);
assertEquals(AgentStat.NOT_COLLECTED, agentStat.getSampledNewCount());
assertEquals(AgentStat.NOT_COLLECTED, agentStat.getSampledContinuationCount());
assertEquals(AgentStat.NOT_COLLECTED, agentStat.getUnsampledNewCount());
assertEquals(AgentStat.NOT_COLLECTED, agentStat.getUnsampledContinuationCount());
}
use of com.navercorp.pinpoint.web.vo.AgentStat 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.AgentStat in project pinpoint by naver.
the class LegacyAgentStatChartV1Service 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");
}
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;
}
Aggregations