use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinTransactionBo in project pinpoint by naver.
the class JoinTransactionBoMapperTest method map2Test.
@Test
public void map2Test() {
final TFAgentStat tFAgentStat = new TFAgentStat();
final String id = "testAgent";
tFAgentStat.setAgentId(id);
tFAgentStat.setTimestamp(1491274138454L);
tFAgentStat.setCollectInterval(5000);
final JoinTransactionBoMapper joinTransactionBoMapper = new JoinTransactionBoMapper();
final JoinTransactionBo joinTransactionBo = joinTransactionBoMapper.map(tFAgentStat);
assertEquals(joinTransactionBo, JoinTransactionBo.EMPTY_JOIN_TRANSACTION_BO);
}
use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinTransactionBo in project pinpoint by naver.
the class JoinTransactionSamplerTest method sampleDataPointsTest.
@Test
public void sampleDataPointsTest() {
long currentTime = 1487149800000L;
JoinTransactionSampler joinTransactionSampler = new JoinTransactionSampler();
List<JoinTransactionBo> joinTransactionBoList = createJoinTransactionBoList(currentTime);
AggreJoinTransactionBo aggreJoinTransactionBo = joinTransactionSampler.sampleDataPoints(1, currentTime, joinTransactionBoList, JoinTransactionBo.EMPTY_JOIN_TRANSACTION_BO);
assertEquals(aggreJoinTransactionBo.getId(), "test_app");
assertEquals(aggreJoinTransactionBo.getCollectInterval(), 5000);
assertEquals(aggreJoinTransactionBo.getTotalCountJoinValue(), new JoinLongFieldBo(130l, 10l, "app_1_1", 560l, "app_4_2"));
assertEquals(aggreJoinTransactionBo.getTimestamp(), 1487149800000L);
}
use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinTransactionBo in project pinpoint by naver.
the class JoinTransactionSampler method sampleDataPoints.
@Override
public AggreJoinTransactionBo sampleDataPoints(int index, long timestamp, List<JoinTransactionBo> joinTransactionBoList, JoinTransactionBo previousDataPoint) {
if (CollectionUtils.isEmpty(joinTransactionBoList)) {
return AggreJoinTransactionBo.createUncollectedObject(timestamp);
}
JoinTransactionBo joinTransactionBo = JoinTransactionBo.joinTransactionBoList(joinTransactionBoList, timestamp);
String id = joinTransactionBo.getId();
long collectInterval = joinTransactionBo.getCollectInterval();
final JoinLongFieldBo totalCountJoinValue = joinTransactionBo.getTotalCountJoinValue();
AggreJoinTransactionBo aggreJoinTransactionBo = new AggreJoinTransactionBo(id, collectInterval, totalCountJoinValue, timestamp);
return aggreJoinTransactionBo;
}
use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinTransactionBo in project pinpoint by naver.
the class JoinTransactionSamplerTest method createJoinTransactionBoList.
private List<JoinTransactionBo> createJoinTransactionBoList(long currentTime) {
final String id = "test_app";
List<JoinTransactionBo> joinTransactionBoList = new ArrayList<JoinTransactionBo>();
JoinTransactionBo joinTransactionBo1 = new JoinTransactionBo(id, 5000, 150, 10, "app_1_1", 230, "app_1_2", currentTime);
JoinTransactionBo joinTransactionBo2 = new JoinTransactionBo(id, 5000, 110, 22, "app_2_1", 330, "app_2_2", currentTime + 5000);
JoinTransactionBo joinTransactionBo3 = new JoinTransactionBo(id, 5000, 120, 24, "app_3_1", 540, "app_3_2", currentTime + 10000);
JoinTransactionBo joinTransactionBo4 = new JoinTransactionBo(id, 5000, 130, 25, "app_4_1", 560, "app_4_2", currentTime + 15000);
JoinTransactionBo joinTransactionBo5 = new JoinTransactionBo(id, 5000, 140, 12, "app_5_1", 260, "app_5_2", currentTime + 20000);
joinTransactionBoList.add(joinTransactionBo1);
joinTransactionBoList.add(joinTransactionBo2);
joinTransactionBoList.add(joinTransactionBo3);
joinTransactionBoList.add(joinTransactionBo4);
joinTransactionBoList.add(joinTransactionBo5);
return joinTransactionBoList;
}
use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinTransactionBo in project pinpoint by naver.
the class TransactionCodec 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);
// decode headers
final byte[] header = valueBuffer.readPrefixedBytes();
AgentStatHeaderDecoder headerDecoder = new BitCountingHeaderDecoder(header);
EncodingStrategy<Long> collectIntervalEncodingStrategy = UnsignedLongEncodingStrategy.getFromCode(headerDecoder.getCode());
JoinLongFieldEncodingStrategy totalCountEncodingStrategy = JoinLongFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode());
List<Long> collectIntervalList = this.codec.decodeValues(valueBuffer, collectIntervalEncodingStrategy, numValues);
final List<JoinLongFieldBo> totalCountList = this.codec.decodeValues(valueBuffer, totalCountEncodingStrategy, numValues);
List<JoinStatBo> joinTransactionBoList = new ArrayList<>();
for (int i = 0; i < numValues; i++) {
JoinTransactionBo joinTransactionBo = new JoinTransactionBo();
joinTransactionBo.setId(id);
joinTransactionBo.setTimestamp(timestampList.get(i));
joinTransactionBo.setCollectInterval(collectIntervalList.get(i));
joinTransactionBo.setTotalCountJoinValue(totalCountList.get(i));
joinTransactionBoList.add(joinTransactionBo);
}
return joinTransactionBoList;
}
Aggregations