use of com.navercorp.pinpoint.common.server.bo.AgentStatMemoryGcBo in project pinpoint by naver.
the class AgentStatMemoryGcBoTest method testByteArrayConversion.
@Test
public void testByteArrayConversion() {
// Given
final AgentStatMemoryGcBo.Builder builder = new AgentStatMemoryGcBo.Builder("agentId", 0L, 1L);
builder.gcType(TJvmGcType.G1.name());
builder.jvmMemoryHeapUsed(Long.MIN_VALUE);
builder.jvmMemoryHeapMax(Long.MAX_VALUE);
builder.jvmMemoryNonHeapUsed(Long.MIN_VALUE);
builder.jvmMemoryNonHeapMax(Long.MAX_VALUE);
builder.jvmGcOldCount(1L);
builder.jvmGcOldTime(2L);
final AgentStatMemoryGcBo testBo = builder.build();
// When
final byte[] serializedBo = testBo.writeValue();
final AgentStatMemoryGcBo deserializedBo = new AgentStatMemoryGcBo.Builder(serializedBo).build();
// Then
assertEquals(testBo.getAgentId(), deserializedBo.getAgentId());
assertEquals(testBo.getStartTimestamp(), deserializedBo.getStartTimestamp());
assertEquals(testBo.getTimestamp(), deserializedBo.getTimestamp());
assertEquals(testBo.getGcType(), deserializedBo.getGcType());
assertEquals(testBo.getJvmMemoryHeapUsed(), deserializedBo.getJvmMemoryHeapUsed());
assertEquals(testBo.getJvmMemoryHeapMax(), deserializedBo.getJvmMemoryHeapMax());
assertEquals(testBo.getJvmMemoryNonHeapUsed(), deserializedBo.getJvmMemoryNonHeapUsed());
assertEquals(testBo.getJvmMemoryNonHeapMax(), deserializedBo.getJvmMemoryNonHeapMax());
assertEquals(testBo.getJvmGcOldCount(), deserializedBo.getJvmGcOldCount());
assertEquals(testBo.getJvmGcOldTime(), deserializedBo.getJvmGcOldTime());
}
use of com.navercorp.pinpoint.common.server.bo.AgentStatMemoryGcBo in project pinpoint by naver.
the class LegacyAgentStatMapperTest method createResultForLegacy_serialized_BOs.
private Result createResultForLegacy_serialized_BOs() {
final AgentStatMemoryGcBo.Builder jvmGcBuilder = new AgentStatMemoryGcBo.Builder(AGENT_ID, 0L, TIMESTAMP);
jvmGcBuilder.gcType(GC_TYPE.name());
jvmGcBuilder.jvmGcOldCount(GC_OLD_COUNT);
jvmGcBuilder.jvmGcOldTime(GC_OLD_TIME);
jvmGcBuilder.jvmMemoryHeapUsed(HEAP_USED);
jvmGcBuilder.jvmMemoryHeapMax(HEAP_MAX);
jvmGcBuilder.jvmMemoryNonHeapUsed(NON_HEAP_USED);
jvmGcBuilder.jvmMemoryNonHeapMax(NON_HEAP_MAX);
final AgentStatCpuLoadBo.Builder cpuLoadBuilder = new AgentStatCpuLoadBo.Builder(AGENT_ID, 0L, TIMESTAMP);
cpuLoadBuilder.jvmCpuLoad(JVM_CPU_USAGE);
cpuLoadBuilder.systemCpuLoad(SYS_CPU_USAGE);
final AgentStatMemoryGcBo jvmGc = jvmGcBuilder.build();
final AgentStatCpuLoadBo cpuLoad = cpuLoadBuilder.build();
final Cell jvmGcCell = createCell(AGENT_STAT_CF_STATISTICS_MEMORY_GC, jvmGc.writeValue());
final Cell cpuLoadCell = createCell(AGENT_STAT_CF_STATISTICS_CPU_LOAD, cpuLoad.writeValue());
return Result.create(Arrays.asList(jvmGcCell, cpuLoadCell));
}
use of com.navercorp.pinpoint.common.server.bo.AgentStatMemoryGcBo 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.common.server.bo.AgentStatMemoryGcBo in project pinpoint by naver.
the class LegacyAgentStatMapper method readSerializedBos.
// FIXME (2015.10) Legacy column for storing serialzied Bos separately.
@Deprecated
private List<AgentStat> readSerializedBos(String agentId, long timestamp, Map<byte[], byte[]> qualifierMap) {
AgentStat agentStat = new AgentStat(agentId, timestamp);
if (qualifierMap.containsKey(AGENT_STAT_CF_STATISTICS_MEMORY_GC)) {
AgentStatMemoryGcBo.Builder builder = new AgentStatMemoryGcBo.Builder(qualifierMap.get(AGENT_STAT_CF_STATISTICS_MEMORY_GC));
AgentStatMemoryGcBo agentStatMemoryGcBo = builder.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());
}
if (qualifierMap.containsKey(AGENT_STAT_CF_STATISTICS_CPU_LOAD)) {
AgentStatCpuLoadBo.Builder builder = new AgentStatCpuLoadBo.Builder(qualifierMap.get(AGENT_STAT_CF_STATISTICS_CPU_LOAD));
AgentStatCpuLoadBo agentStatCpuLoadBo = builder.build();
agentStat.setJvmCpuUsage(agentStatCpuLoadBo.getJvmCpuLoad());
agentStat.setSystemCpuUsage(agentStatCpuLoadBo.getSystemCpuLoad());
}
List<AgentStat> result = new ArrayList<>(1);
result.add(agentStat);
return result;
}
Aggregations