use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinTotalThreadCountBo in project pinpoint by naver.
the class JoinTotalThreadCountSampler method sampleDataPoints.
@Override
public AggreJoinTotalThreadCountBo sampleDataPoints(int index, long timestamp, List<JoinTotalThreadCountBo> dataPoints, JoinTotalThreadCountBo previousDataPoint) {
if (CollectionUtils.isEmpty(dataPoints)) {
return AggreJoinTotalThreadCountBo.createUncollectedObject(timestamp);
}
JoinTotalThreadCountBo joinTotalThreadCountBo = JoinTotalThreadCountBo.joinTotalThreadCountBoList(dataPoints, timestamp);
String id = joinTotalThreadCountBo.getId();
final JoinLongFieldBo totalThreadCountJoinValue = joinTotalThreadCountBo.getTotalThreadCountJoinValue();
AggreJoinTotalThreadCountBo aggreJoinTotalThraedCountBo = new AggreJoinTotalThreadCountBo(id, timestamp, totalThreadCountJoinValue);
return aggreJoinTotalThraedCountBo;
}
use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinTotalThreadCountBo in project pinpoint by naver.
the class JoinTotalThreadCountBoMapperTest method map2Test.
@Test
public void map2Test() {
final TFAgentStat tFAgentStat = new TFAgentStat();
tFAgentStat.setAgentId("testAgent");
tFAgentStat.setTimestamp(1491274138454L);
final JoinTotalThreadCountBoMapper mapper = new JoinTotalThreadCountBoMapper();
final JoinTotalThreadCountBo joinTotalThreadCountBo = mapper.map(tFAgentStat);
assertEquals(joinTotalThreadCountBo, joinTotalThreadCountBo.EMPTY_TOTAL_THREAD_COUNT_BO);
}
use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinTotalThreadCountBo in project pinpoint by naver.
the class JoinTotalThreadCountBoMapper method build.
@Override
public void build(TFAgentStat tFAgentStat, JoinAgentStatBo.Builder builder) {
JoinTotalThreadCountBo joinTotalThreadCountBo = this.map(tFAgentStat);
if (joinTotalThreadCountBo == JoinTotalThreadCountBo.EMPTY_TOTAL_THREAD_COUNT_BO) {
return;
}
builder.addTotalThreadCount(joinTotalThreadCountBo);
}
use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinTotalThreadCountBo in project pinpoint by naver.
the class TotalThreadCountCodec method decodeValues.
@Override
public List<JoinStatBo> decodeValues(Buffer valueBuffer, ApplicationStatDecodingContext decodingContext) {
final String id = decodingContext.getApplicationId();
final long baseTimestamp = decodingContext.getBaseTimestamp();
final long timestampDelta = decodingContext.getTimestampDelta();
final long initialTimestamp = baseTimestamp + timestampDelta;
int numValues = valueBuffer.readVInt();
List<Long> timestampList = this.codec.decodeTimestamps(initialTimestamp, valueBuffer, numValues);
final byte[] header = valueBuffer.readPrefixedBytes();
AgentStatHeaderDecoder headerDecoder = new BitCountingHeaderDecoder(header);
JoinLongFieldEncodingStrategy totalThreadCountEncodingStrategy = JoinLongFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode());
final List<JoinLongFieldBo> totalThreadCountList = this.codec.decodeValues(valueBuffer, totalThreadCountEncodingStrategy, numValues);
List<JoinStatBo> joinTotalThreadCountBoList = new ArrayList<JoinStatBo>();
for (int i = 0; i < numValues; i++) {
JoinTotalThreadCountBo joinTotalThreadCountBo = new JoinTotalThreadCountBo();
joinTotalThreadCountBo.setId(id);
joinTotalThreadCountBo.setTimestamp(timestampList.get(i));
joinTotalThreadCountBo.setTotalThreadCountJoinValue(totalThreadCountList.get(i));
joinTotalThreadCountBoList.add(joinTotalThreadCountBo);
}
return joinTotalThreadCountBoList;
}
use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinTotalThreadCountBo in project pinpoint by naver.
the class JoinAgentStatBoMapperTest method map6Test.
@Test
public void map6Test() {
final String agentId = "testAgent";
final JoinAgentStatBoMapper joinAgentStatBoMapper = new JoinAgentStatBoMapper();
final TFAgentStatBatch tFAgentStatBatch = new TFAgentStatBatch();
tFAgentStatBatch.setStartTimestamp(1491274138454L);
tFAgentStatBatch.setAgentId(agentId);
final TFTotalThreadCount tfTotalThreadCount = new TFTotalThreadCount();
tfTotalThreadCount.setTotalThreadCount(100);
final TFAgentStat tFAgentStat = new TFAgentStat();
tFAgentStat.setAgentId(agentId);
tFAgentStat.setTimestamp(1491274148454L);
tFAgentStat.setTotalThreadCount(tfTotalThreadCount);
final TFTotalThreadCount tfTotalThreadCount2 = new TFTotalThreadCount();
tfTotalThreadCount2.setTotalThreadCount(120);
final TFAgentStat tFAgentStat2 = new TFAgentStat();
tFAgentStat2.setAgentId(agentId);
tFAgentStat2.setTimestamp(1491275148454L);
tFAgentStat2.setTotalThreadCount(tfTotalThreadCount2);
final List<TFAgentStat> tFAgentStatList = new ArrayList<>(2);
tFAgentStatList.add(tFAgentStat);
tFAgentStatList.add(tFAgentStat2);
tFAgentStatBatch.setAgentStats(tFAgentStatList);
JoinAgentStatBo joinAgentStatBo = joinAgentStatBoMapper.map(tFAgentStatBatch);
assertEquals(agentId, joinAgentStatBo.getId());
assertEquals(1491274138454L, joinAgentStatBo.getAgentStartTimestamp());
assertEquals(1491274148454L, joinAgentStatBo.getTimestamp());
List<JoinTotalThreadCountBo> joinTotalThreadCountBoList = joinAgentStatBo.getJoinTotalThreadCountBoList();
assertEquals(joinTotalThreadCountBoList.size(), 2);
JoinTotalThreadCountBo joinTotalThreadCountBo = joinTotalThreadCountBoList.get(0);
assertEquals(agentId, joinTotalThreadCountBo.getId());
assertEquals(1491274148454L, joinTotalThreadCountBo.getTimestamp());
assertEquals(new JoinLongFieldBo(100L, 100L, agentId, 100L, agentId), joinTotalThreadCountBo.getTotalThreadCountJoinValue());
JoinTotalThreadCountBo joinTotalThreadCountBo2 = joinTotalThreadCountBoList.get(1);
assertEquals(agentId, joinTotalThreadCountBo2.getId());
assertEquals(1491275148454L, joinTotalThreadCountBo2.getTimestamp());
assertEquals(new JoinLongFieldBo(120L, 120L, agentId, 120L, agentId), joinTotalThreadCountBo2.getTotalThreadCountJoinValue());
}
Aggregations