use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinDirectBufferBo in project pinpoint by naver.
the class TBaseFlatMapperTest method assertJoinDirectBufferBo.
private void assertJoinDirectBufferBo(List<JoinDirectBufferBo> joinDirectBufferBoList) {
assertEquals(2, joinDirectBufferBoList.size());
JoinDirectBufferBo joinDirectBufferBo = joinDirectBufferBoList.get(0);
assertEquals(joinDirectBufferBo.getId(), AGENT_ID);
assertEquals(joinDirectBufferBo.getTimestamp(), 1491274143454L);
JoinLongFieldBo directCountJoinValue = joinDirectBufferBo.getDirectCountJoinValue();
assertEquals(directCountJoinValue.getAvg(), 10, 0);
assertEquals(directCountJoinValue.getMin(), 10, 0);
assertEquals(directCountJoinValue.getMax(), 10, 0);
JoinLongFieldBo directMemoryUsedJoinValue = joinDirectBufferBo.getDirectMemoryUsedJoinValue();
assertEquals(directMemoryUsedJoinValue.getAvg(), 20, 0);
assertEquals(directMemoryUsedJoinValue.getMin(), 20, 0);
assertEquals(directMemoryUsedJoinValue.getMax(), 20, 0);
JoinLongFieldBo mappedCountJoinValue = joinDirectBufferBo.getMappedCountJoinValue();
assertEquals(mappedCountJoinValue.getAvg(), 30, 0);
assertEquals(mappedCountJoinValue.getMin(), 30, 0);
assertEquals(mappedCountJoinValue.getMax(), 30, 0);
JoinLongFieldBo mappedMemoryUsedJoinValue = joinDirectBufferBo.getMappedMemoryUsedJoinValue();
assertEquals(mappedMemoryUsedJoinValue.getAvg(), 40, 0);
assertEquals(mappedMemoryUsedJoinValue.getMin(), 40, 0);
assertEquals(mappedMemoryUsedJoinValue.getMax(), 40, 0);
joinDirectBufferBo = joinDirectBufferBoList.get(1);
assertEquals(joinDirectBufferBo.getId(), AGENT_ID);
assertEquals(joinDirectBufferBo.getTimestamp(), 1491274148454L);
directCountJoinValue = joinDirectBufferBo.getDirectCountJoinValue();
assertEquals(directCountJoinValue.getAvg(), 50, 0);
assertEquals(directCountJoinValue.getMin(), 50, 0);
assertEquals(directCountJoinValue.getMax(), 50, 0);
directMemoryUsedJoinValue = joinDirectBufferBo.getDirectMemoryUsedJoinValue();
assertEquals(directMemoryUsedJoinValue.getAvg(), 60, 0);
assertEquals(directMemoryUsedJoinValue.getMin(), 60, 0);
assertEquals(directMemoryUsedJoinValue.getMax(), 60, 0);
mappedCountJoinValue = joinDirectBufferBo.getMappedCountJoinValue();
assertEquals(mappedCountJoinValue.getAvg(), 70, 0);
assertEquals(mappedCountJoinValue.getMin(), 70, 0);
assertEquals(mappedCountJoinValue.getMax(), 70, 0);
mappedMemoryUsedJoinValue = joinDirectBufferBo.getMappedMemoryUsedJoinValue();
assertEquals(mappedMemoryUsedJoinValue.getAvg(), 80, 0);
assertEquals(mappedMemoryUsedJoinValue.getMin(), 80, 0);
assertEquals(mappedMemoryUsedJoinValue.getMax(), 80, 0);
}
use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinDirectBufferBo in project pinpoint by naver.
the class JoinDirectBufferBoMapper method map.
@Override
public JoinDirectBufferBo map(TFAgentStat tFAgentStat) {
if (!tFAgentStat.isSetDirectBuffer()) {
return JoinDirectBufferBo.EMPTY_JOIN_DIRECT_BUFFER_BO;
}
JoinDirectBufferBo joinDirectBufferBo = new JoinDirectBufferBo();
final String agentId = tFAgentStat.getAgentId();
joinDirectBufferBo.setId(agentId);
joinDirectBufferBo.setTimestamp(tFAgentStat.getTimestamp());
TFDirectBuffer tFDirectBuffer = tFAgentStat.getDirectBuffer();
final long directCount = tFDirectBuffer.getDirectCount();
joinDirectBufferBo.setDirectCountJoinValue(new JoinLongFieldBo(directCount, directCount, agentId, directCount, agentId));
final long directMemoryUsed = tFDirectBuffer.getDirectMemoryUsed();
joinDirectBufferBo.setDirectMemoryUsedJoinValue(new JoinLongFieldBo(directMemoryUsed, directMemoryUsed, agentId, directMemoryUsed, agentId));
final long mappedCount = tFDirectBuffer.getMappedCount();
joinDirectBufferBo.setMappedCountJoinValue(new JoinLongFieldBo(mappedCount, mappedCount, agentId, mappedCount, agentId));
final long mappedMemoryUsed = tFDirectBuffer.getMappedMemoryUsed();
joinDirectBufferBo.setMappedMemoryUsedJoinValue(new JoinLongFieldBo(mappedMemoryUsed, mappedMemoryUsed, agentId, mappedMemoryUsed, agentId));
return joinDirectBufferBo;
}
use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinDirectBufferBo in project pinpoint by naver.
the class DirectBufferCodec method encodeValues.
@Override
public void encodeValues(Buffer valueBuffer, List<JoinStatBo> joinDirectBufferBoList) {
if (CollectionUtils.isEmpty(joinDirectBufferBoList)) {
throw new IllegalArgumentException("directBufferBoList must not be empty");
}
final int numValues = joinDirectBufferBoList.size();
valueBuffer.putVInt(numValues);
List<Long> timestamps = new ArrayList<>(numValues);
JoinLongFieldStrategyAnalyzer.Builder directCountAnalyzerBuilder = new JoinLongFieldStrategyAnalyzer.Builder();
JoinLongFieldStrategyAnalyzer.Builder directMemoryUsedAnalyzerBuilder = new JoinLongFieldStrategyAnalyzer.Builder();
JoinLongFieldStrategyAnalyzer.Builder mappedCountAnalyzerBuilder = new JoinLongFieldStrategyAnalyzer.Builder();
JoinLongFieldStrategyAnalyzer.Builder mappedMemoryUsedAnalyzerBuilder = new JoinLongFieldStrategyAnalyzer.Builder();
for (JoinStatBo joinStatBo : joinDirectBufferBoList) {
JoinDirectBufferBo joinDirectBufferBo = (JoinDirectBufferBo) joinStatBo;
timestamps.add(joinDirectBufferBo.getTimestamp());
directCountAnalyzerBuilder.addValue(joinDirectBufferBo.getDirectCountJoinValue());
directMemoryUsedAnalyzerBuilder.addValue(joinDirectBufferBo.getDirectMemoryUsedJoinValue());
mappedCountAnalyzerBuilder.addValue(joinDirectBufferBo.getMappedCountJoinValue());
mappedMemoryUsedAnalyzerBuilder.addValue(joinDirectBufferBo.getMappedMemoryUsedJoinValue());
}
codec.encodeTimestamps(valueBuffer, timestamps);
encodeDataPoints(valueBuffer, directCountAnalyzerBuilder.build(), directMemoryUsedAnalyzerBuilder.build(), mappedCountAnalyzerBuilder.build(), mappedMemoryUsedAnalyzerBuilder.build());
}
use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinDirectBufferBo in project pinpoint by naver.
the class JoinDirectBufferSampler method sampleDataPoints.
@Override
public AggreJoinDirectBufferBo sampleDataPoints(int timeWindowIndex, long timestamp, List<JoinDirectBufferBo> joinDirectBufferBoList, JoinDirectBufferBo previousDataPoint) {
if (CollectionUtils.isEmpty(joinDirectBufferBoList)) {
return AggreJoinDirectBufferBo.createUncollectedObject(timestamp);
}
JoinDirectBufferBo joinDirectBufferBo = JoinDirectBufferBo.joinDirectBufferBoList(joinDirectBufferBoList, timestamp);
String id = joinDirectBufferBo.getId();
final JoinLongFieldBo directCountJoinValue = joinDirectBufferBo.getDirectCountJoinValue();
final JoinLongFieldBo directMemoryUsedJoinValue = joinDirectBufferBo.getDirectMemoryUsedJoinValue();
final JoinLongFieldBo mappedCountJoinValue = joinDirectBufferBo.getMappedCountJoinValue();
final JoinLongFieldBo mappedMemoryUsedJoinValue = joinDirectBufferBo.getMappedMemoryUsedJoinValue();
AggreJoinDirectBufferBo aggreJoinDirectBufferBo = new AggreJoinDirectBufferBo(id, directCountJoinValue, directMemoryUsedJoinValue, mappedCountJoinValue, mappedMemoryUsedJoinValue, timestamp);
return aggreJoinDirectBufferBo;
}
use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinDirectBufferBo in project pinpoint by naver.
the class DirectBufferCodecTest method createJoinDirectBufferBoList.
private List<JoinStatBo> createJoinDirectBufferBoList(long currentTime) {
final String id = "test_app";
final List<JoinStatBo> joinDirectBufferBoList = new ArrayList<>();
JoinDirectBufferBo joinDirectBufferBo1 = new JoinDirectBufferBo(id, 80, 1000, "agent1_1", 30, "agent1_2", 80, 1000, "agent1_1", 30, "agent1_2", 80, 1000, "agent1_1", 30, "agent1_2", 80, 1000, "agent1_1", 30, "agent1_2", currentTime);
JoinDirectBufferBo joinDirectBufferBo2 = new JoinDirectBufferBo(id, 70, 900, "agent2_1", 20, "agent2_2", 70, 900, "agent2_1", 20, "agent2_2", 70, 900, "agent2_1", 20, "agent2_2", 70, 900, "agent2_1", 20, "agent2_2", currentTime + 5000);
JoinDirectBufferBo joinDirectBufferBo4 = new JoinDirectBufferBo(id, 60, 800, "agent4_1", 15, "agent4_2", 60, 800, "agent4_1", 15, "agent4_2", 60, 800, "agent4_1", 15, "agent4_2", 60, 800, "agent4_1", 15, "agent4_2", currentTime + 15000);
JoinDirectBufferBo joinDirectBufferBo3 = new JoinDirectBufferBo(id, 50, 700, "agent3_1", 10, "agent3_2", 50, 700, "agent3_1", 10, "agent3_2", 50, 700, "agent3_1", 10, "agent3_2", 50, 700, "agent3_1", 10, "agent3_2", currentTime + 10000);
JoinDirectBufferBo joinDirectBufferBo5 = new JoinDirectBufferBo(id, 40, 600, "agent5_1", 5, "agent5_2", 40, 600, "agent5_1", 5, "agent5_2", 40, 600, "agent5_1", 5, "agent5_2", 40, 600, "agent5_1", 5, "agent5_2", currentTime + 20000);
joinDirectBufferBoList.add(joinDirectBufferBo1);
joinDirectBufferBoList.add(joinDirectBufferBo2);
joinDirectBufferBoList.add(joinDirectBufferBo3);
joinDirectBufferBoList.add(joinDirectBufferBo4);
joinDirectBufferBoList.add(joinDirectBufferBo5);
return joinDirectBufferBoList;
}
Aggregations