use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinTotalThreadCountBo in project pinpoint by naver.
the class JoinTotalThreadSamplerTest method sampleDataPoints.
@Test
public void sampleDataPoints() {
JoinTotalThreadCountSampler joinTotalThreadCountSampler = new JoinTotalThreadCountSampler();
List<JoinTotalThreadCountBo> joinTotalThreadCountBoList = new ArrayList<>(5);
long timeStamp = new Date().getTime();
joinTotalThreadCountBoList.add(new JoinTotalThreadCountBo("testApp", timeStamp + 5000, 11, 60, "agent1_1", 20, "agent1_2"));
joinTotalThreadCountBoList.add(new JoinTotalThreadCountBo("testApp", timeStamp + 10000, 22, 52, "agent2_1", 10, "agent2_2"));
joinTotalThreadCountBoList.add(new JoinTotalThreadCountBo("testApp", timeStamp + 15000, 33, 39, "agent3_1", 90, "agent3_2"));
joinTotalThreadCountBoList.add(new JoinTotalThreadCountBo("testApp", timeStamp + 20000, 44, 42, "agent4_1", 25, "agent4_2"));
joinTotalThreadCountBoList.add(new JoinTotalThreadCountBo("testApp", timeStamp + 25000, 55, 55, "agent5_1", 54, "agent5_2"));
AggreJoinTotalThreadCountBo aggreJoinTotalThraedCountBo = joinTotalThreadCountSampler.sampleDataPoints(0, new Date().getTime(), joinTotalThreadCountBoList, new JoinTotalThreadCountBo());
assertEquals(aggreJoinTotalThraedCountBo.getId(), "testApp");
assertEquals(aggreJoinTotalThraedCountBo.getTotalThreadCountJoinValue(), new JoinLongFieldBo(33L, 39L, "agent3_1", 90L, "agent3_2"));
}
use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinTotalThreadCountBo in project pinpoint by naver.
the class TotalThreadCountCodecTest method createJoinTotalThreadCountBoList.
private List<JoinStatBo> createJoinTotalThreadCountBoList(long currentTime) {
final String id = "test_app";
final List<JoinStatBo> joinTotalThreadCountBoList = new ArrayList<>();
JoinTotalThreadCountBo joinTotalThreadCountBo1 = new JoinTotalThreadCountBo(id, currentTime, 80, 1000, "agent1_1", 30, "agent1_2");
JoinTotalThreadCountBo joinTotalThreadCountBo2 = new JoinTotalThreadCountBo(id, currentTime + 5000, 70, 900, "agent2_1", 20, "agent2_2");
JoinTotalThreadCountBo joinTotalThreadCountBo3 = new JoinTotalThreadCountBo(id, currentTime + 15000, 60, 800, "agent4_1", 15, "agent4_2");
JoinTotalThreadCountBo joinTotalThreadCountBo4 = new JoinTotalThreadCountBo(id, currentTime + 10000, 50, 700, "agent3_1", 10, "agent3_2");
JoinTotalThreadCountBo joinTotalThreadCountBo5 = new JoinTotalThreadCountBo(id, currentTime + 20000, 40, 600, "agent5_1", 5, "agent5_2");
joinTotalThreadCountBoList.add(joinTotalThreadCountBo1);
joinTotalThreadCountBoList.add(joinTotalThreadCountBo2);
joinTotalThreadCountBoList.add(joinTotalThreadCountBo3);
joinTotalThreadCountBoList.add(joinTotalThreadCountBo4);
joinTotalThreadCountBoList.add(joinTotalThreadCountBo5);
return joinTotalThreadCountBoList;
}
use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinTotalThreadCountBo in project pinpoint by naver.
the class TotalThreadCountCodec method encodeValues.
@Override
public void encodeValues(Buffer valueBuffer, List<JoinStatBo> joinTotalThreadCountBoList) {
if (CollectionUtils.isEmpty(joinTotalThreadCountBoList)) {
throw new IllegalArgumentException("joinTotalThreadCountBoList must not be empty");
}
final int numValues = joinTotalThreadCountBoList.size();
valueBuffer.putVInt(numValues);
List<Long> timestamps = new ArrayList<Long>(numValues);
JoinLongFieldStrategyAnalyzer.Builder totalThreadCountAnalyzerBuilder = new JoinLongFieldStrategyAnalyzer.Builder();
for (JoinStatBo joinStatBo : joinTotalThreadCountBoList) {
JoinTotalThreadCountBo joinTotalThreadCountBo = (JoinTotalThreadCountBo) joinStatBo;
timestamps.add(joinTotalThreadCountBo.getTimestamp());
totalThreadCountAnalyzerBuilder.addValue(joinTotalThreadCountBo.getTotalThreadCountJoinValue());
}
codec.encodeTimestamps(valueBuffer, timestamps);
encodeDataPoints(valueBuffer, totalThreadCountAnalyzerBuilder.build());
}
use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinTotalThreadCountBo in project pinpoint by naver.
the class JoinTotalThreadCountBoMapperTest method mapTest.
@Test
public void mapTest() throws Exception {
final TFAgentStat tFAgentStat = new TFAgentStat();
tFAgentStat.setAgentId("testAgent");
tFAgentStat.setTimestamp(1491274138454L);
final TFTotalThreadCount tfTotalThreadCount = new TFTotalThreadCount();
tfTotalThreadCount.setTotalThreadCount(50);
tFAgentStat.setTotalThreadCount(tfTotalThreadCount);
final JoinTotalThreadCountBoMapper mapper = new JoinTotalThreadCountBoMapper();
final JoinTotalThreadCountBo joinTotalThreadCountBo = mapper.map(tFAgentStat);
assertNotNull(joinTotalThreadCountBo);
assertEquals(joinTotalThreadCountBo.getId(), "testAgent");
assertEquals(joinTotalThreadCountBo.getTimestamp(), 1491274138454L);
assertEquals(joinTotalThreadCountBo.getTotalThreadCountJoinValue(), new JoinLongFieldBo(50L, 50L, "testAgent", 50L, "testAgent"));
}
use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinTotalThreadCountBo in project pinpoint by naver.
the class JoinTotalThreadCountBoMapper method map.
@Override
public JoinTotalThreadCountBo map(TFAgentStat tFAgentStat) {
if (!tFAgentStat.isSetTotalThreadCount()) {
return JoinTotalThreadCountBo.EMPTY_TOTAL_THREAD_COUNT_BO;
}
JoinTotalThreadCountBo joinTotalThreadCountBo = new JoinTotalThreadCountBo();
final String agentId = tFAgentStat.getAgentId();
final long totalThreadCount = tFAgentStat.getTotalThreadCount().getTotalThreadCount();
joinTotalThreadCountBo.setId(agentId);
joinTotalThreadCountBo.setTimestamp(tFAgentStat.getTimestamp());
joinTotalThreadCountBo.setTotalThreadCountJoinValue(new JoinLongFieldBo(totalThreadCount, totalThreadCount, agentId, totalThreadCount, agentId));
return joinTotalThreadCountBo;
}
Aggregations