use of com.navercorp.pinpoint.thrift.dto.TJvmGc in project pinpoint by naver.
the class JvmGcCommonMetricCollector method collect.
@Override
public TJvmGc collect() {
TJvmGc jvmGc = new TJvmGc();
jvmGc.setJvmMemoryHeapMax(memoryMetric.heapMax());
jvmGc.setJvmMemoryHeapUsed(memoryMetric.heapUsed());
jvmGc.setJvmMemoryNonHeapMax(memoryMetric.nonHeapMax());
jvmGc.setJvmMemoryNonHeapUsed(memoryMetric.nonHeapUsed());
jvmGc.setJvmGcOldCount(garbageCollectorMetric.gcOldCount());
jvmGc.setJvmGcOldTime(garbageCollectorMetric.gcOldTime());
jvmGc.setType(garbageCollectorMetric.gcType());
return jvmGc;
}
use of com.navercorp.pinpoint.thrift.dto.TJvmGc in project pinpoint by naver.
the class LegacyAgentStatMapperTest method createResultForLegacyWith_AGENT_STAT_CF_STATISTICS_V1.
private Result createResultForLegacyWith_AGENT_STAT_CF_STATISTICS_V1() throws TException {
final TAgentStat agentStat = new TAgentStat();
final TJvmGc gc = new TJvmGc();
gc.setType(GC_TYPE);
gc.setJvmGcOldCount(GC_OLD_COUNT);
gc.setJvmGcOldTime(GC_OLD_TIME);
gc.setJvmMemoryHeapUsed(HEAP_USED);
gc.setJvmMemoryHeapMax(HEAP_MAX);
gc.setJvmMemoryNonHeapUsed(NON_HEAP_USED);
gc.setJvmMemoryNonHeapMax(NON_HEAP_MAX);
agentStat.setGc(gc);
final TProtocolFactory factory = new TCompactProtocol.Factory();
final TSerializer serializer = new TSerializer(factory);
final byte[] qualifier = AGENT_STAT_CF_STATISTICS_V1;
final byte[] value = serializer.serialize(agentStat);
return Result.create(Arrays.asList(createCell(qualifier, value)));
}
use of com.navercorp.pinpoint.thrift.dto.TJvmGc 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.thrift.dto.TJvmGc in project pinpoint by naver.
the class HbaseAgentStatDao method createPut.
private Put createPut(TAgentStat agentStat) {
long timestamp = agentStat.getTimestamp();
byte[] key = getDistributedRowKey(agentStat, timestamp);
Put put = new Put(key);
final long collectInterval = agentStat.getCollectInterval();
put.addColumn(AGENT_STAT_CF_STATISTICS, AGENT_STAT_COL_INTERVAL, Bytes.toBytes(collectInterval));
// GC, Memory
if (agentStat.isSetGc()) {
TJvmGc gc = agentStat.getGc();
put.addColumn(AGENT_STAT_CF_STATISTICS, AGENT_STAT_COL_GC_TYPE, Bytes.toBytes(gc.getType().name()));
put.addColumn(AGENT_STAT_CF_STATISTICS, AGENT_STAT_COL_GC_OLD_COUNT, Bytes.toBytes(gc.getJvmGcOldCount()));
put.addColumn(AGENT_STAT_CF_STATISTICS, AGENT_STAT_COL_GC_OLD_TIME, Bytes.toBytes(gc.getJvmGcOldTime()));
put.addColumn(AGENT_STAT_CF_STATISTICS, AGENT_STAT_COL_HEAP_USED, Bytes.toBytes(gc.getJvmMemoryHeapUsed()));
put.addColumn(AGENT_STAT_CF_STATISTICS, AGENT_STAT_COL_HEAP_MAX, Bytes.toBytes(gc.getJvmMemoryHeapMax()));
put.addColumn(AGENT_STAT_CF_STATISTICS, AGENT_STAT_COL_NON_HEAP_USED, Bytes.toBytes(gc.getJvmMemoryNonHeapUsed()));
put.addColumn(AGENT_STAT_CF_STATISTICS, AGENT_STAT_COL_NON_HEAP_MAX, Bytes.toBytes(gc.getJvmMemoryNonHeapMax()));
} else {
put.addColumn(AGENT_STAT_CF_STATISTICS, AGENT_STAT_COL_GC_TYPE, Bytes.toBytes(TJvmGcType.UNKNOWN.name()));
}
// CPU
if (agentStat.isSetCpuLoad()) {
TCpuLoad cpuLoad = agentStat.getCpuLoad();
double jvmCpuLoad = AgentStatUtils.convertLongToDouble(AgentStatUtils.convertDoubleToLong(cpuLoad.getJvmCpuLoad()));
double systemCpuLoad = AgentStatUtils.convertLongToDouble(AgentStatUtils.convertDoubleToLong(cpuLoad.getSystemCpuLoad()));
put.addColumn(AGENT_STAT_CF_STATISTICS, AGENT_STAT_COL_JVM_CPU, Bytes.toBytes(jvmCpuLoad));
put.addColumn(AGENT_STAT_CF_STATISTICS, AGENT_STAT_COL_SYS_CPU, Bytes.toBytes(systemCpuLoad));
}
// Transaction
if (agentStat.isSetTransaction()) {
TTransaction transaction = agentStat.getTransaction();
put.addColumn(AGENT_STAT_CF_STATISTICS, AGENT_STAT_COL_TRANSACTION_SAMPLED_NEW, Bytes.toBytes(transaction.getSampledNewCount()));
put.addColumn(AGENT_STAT_CF_STATISTICS, AGENT_STAT_COL_TRANSACTION_SAMPLED_CONTINUATION, Bytes.toBytes(transaction.getSampledContinuationCount()));
put.addColumn(AGENT_STAT_CF_STATISTICS, AGENT_STAT_COL_TRANSACTION_UNSAMPLED_NEW, Bytes.toBytes(transaction.getUnsampledNewCount()));
put.addColumn(AGENT_STAT_CF_STATISTICS, AGENT_STAT_COL_TRANSACTION_UNSAMPLED_CONTINUATION, Bytes.toBytes(transaction.getUnsampledContinuationCount()));
}
// Active Trace
if (agentStat.isSetActiveTrace()) {
TActiveTrace activeTrace = agentStat.getActiveTrace();
if (activeTrace.isSetHistogram()) {
ActiveTraceHistogramBo activeTraceHistogramBo = this.activeTraceHistogramBoMapper.map(activeTrace.getHistogram());
put.addColumn(AGENT_STAT_CF_STATISTICS, AGENT_STAT_COL_ACTIVE_TRACE_HISTOGRAM, activeTraceHistogramBo.writeValue());
}
}
return put;
}
use of com.navercorp.pinpoint.thrift.dto.TJvmGc in project pinpoint by naver.
the class AgentStatHandlerV2Test method createAgentStat.
private TAgentStat createAgentStat(String agentId, long startTimestamp) {
final TAgentStat agentStat = new TAgentStat();
agentStat.setAgentId(agentId);
agentStat.setStartTimestamp(startTimestamp);
agentStat.setGc(new TJvmGc());
agentStat.setCpuLoad(new TCpuLoad());
agentStat.setDataSourceList(new TDataSourceList());
return agentStat;
}
Aggregations