use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo in project pinpoint by naver.
the class FileDescriptorCodecTest method encodeAndDecodeTest.
@Test
public void encodeAndDecodeTest() {
final String id = "test_app";
final long currentTime = new Date().getTime();
final AgentStatDataPointCodec agentStatDataPointCodec = new AgentStatDataPointCodec();
final FileDescriptorCodec fileDescriptorCodec = new FileDescriptorCodec(agentStatDataPointCodec);
final Buffer encodedValueBuffer = new AutomaticBuffer();
final List<JoinStatBo> joinFileDescriptorBoList = createJoinFileDescriptorBoList(currentTime);
encodedValueBuffer.putByte(fileDescriptorCodec.getVersion());
fileDescriptorCodec.encodeValues(encodedValueBuffer, joinFileDescriptorBoList);
final Buffer valueBuffer = new FixedBuffer(encodedValueBuffer.getBuffer());
;
final long baseTimestamp = AgentStatUtils.getBaseTimestamp(currentTime);
final long timestampDelta = currentTime - baseTimestamp;
final ApplicationStatDecodingContext decodingContext = new ApplicationStatDecodingContext();
decodingContext.setApplicationId(id);
decodingContext.setBaseTimestamp(baseTimestamp);
decodingContext.setTimestampDelta(timestampDelta);
assertEquals(valueBuffer.readByte(), fileDescriptorCodec.getVersion());
List<JoinStatBo> decodedJoinFileDescriptorBoList = fileDescriptorCodec.decodeValues(valueBuffer, decodingContext);
for (int i = 0; i < decodedJoinFileDescriptorBoList.size(); i++) {
assertEquals(decodedJoinFileDescriptorBoList.get(i), joinFileDescriptorBoList.get(i));
}
}
use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo in project pinpoint by naver.
the class MemoryCodecTest method createJoinMemoryBoList.
private List<JoinStatBo> createJoinMemoryBoList(long currentTime) {
final String id = "test_app";
List<JoinStatBo> joinMemoryBoList = new ArrayList<JoinStatBo>();
JoinMemoryBo joinMemoryBo1 = new JoinMemoryBo(id, currentTime, 3000, 2000, 5000, "app_1_1", "app_1_2", 500, 50, 600, "app_1_3", "app_1_4");
JoinMemoryBo joinMemoryBo2 = new JoinMemoryBo(id, currentTime + 5000, 4000, 1000, 7000, "app_2_1", "app_2_2", 400, 150, 600, "app_2_3", "app_2_4");
JoinMemoryBo joinMemoryBo3 = new JoinMemoryBo(id, currentTime + 10000, 5000, 3000, 8000, "app_3_1", "app_3_2", 200, 100, 200, "app_3_3", "app_3_4");
JoinMemoryBo joinMemoryBo4 = new JoinMemoryBo(id, currentTime + 15000, 1000, 100, 3000, "app_4_1", "app_4_2", 100, 900, 1000, "app_4_3", "app_4_4");
JoinMemoryBo joinMemoryBo5 = new JoinMemoryBo(id, currentTime + 20000, 2000, 1000, 6000, "app_5_1", "app_5_2", 300, 100, 2900, "app_5_3", "app_5_4");
joinMemoryBoList.add(joinMemoryBo1);
joinMemoryBoList.add(joinMemoryBo3);
joinMemoryBoList.add(joinMemoryBo2);
joinMemoryBoList.add(joinMemoryBo5);
joinMemoryBoList.add(joinMemoryBo4);
return joinMemoryBoList;
}
use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo in project pinpoint by naver.
the class TransactionCodecTest method createJoinTransactionBoList.
private List<JoinStatBo> createJoinTransactionBoList(long currentTime) {
final String id = "test_app";
List<JoinStatBo> joinTransactionBoList = new ArrayList<JoinStatBo>();
JoinTransactionBo joinTransactionBo1 = new JoinTransactionBo(id, 5000, 150, 10, "app_1_1", 230, "app_1_2", currentTime);
JoinTransactionBo joinTransactionBo2 = new JoinTransactionBo(id, 10000, 110, 22, "app_2_1", 330, "app_2_2", currentTime + 5000);
JoinTransactionBo joinTransactionBo3 = new JoinTransactionBo(id, 15000, 120, 24, "app_3_1", 540, "app_3_2", currentTime + 10000);
JoinTransactionBo joinTransactionBo4 = new JoinTransactionBo(id, 20000, 130, 25, "app_4_1", 560, "app_4_2", currentTime + 15000);
JoinTransactionBo joinTransactionBo5 = new JoinTransactionBo(id, 25000, 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.JoinStatBo in project pinpoint by naver.
the class ApplicationStatMapper method mapRow.
@Override
public List<JoinStatBo> mapRow(Result result, int rowNum) throws Exception {
if (result.isEmpty()) {
return Collections.emptyList();
}
final byte[] distributedRowKey = result.getRow();
final String applicationId = this.hbaseOperationFactory.getApplicationId(distributedRowKey);
final long baseTimestamp = this.hbaseOperationFactory.getBaseTimestamp(distributedRowKey);
List<JoinStatBo> dataPoints = new ArrayList<>();
for (Cell cell : result.rawCells()) {
if (CellUtil.matchingFamily(cell, HbaseColumnFamily.APPLICATION_STAT_STATISTICS.getName())) {
Buffer qualifierBuffer = new OffsetFixedBuffer(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength());
Buffer valueBuffer = new OffsetFixedBuffer(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength());
long timestampDelta = this.decoder.decodeQualifier(qualifierBuffer);
ApplicationStatDecodingContext decodingContext = new ApplicationStatDecodingContext();
decodingContext.setApplicationId(applicationId);
decodingContext.setBaseTimestamp(baseTimestamp);
decodingContext.setTimestampDelta(timestampDelta);
List<JoinStatBo> candidates = this.decoder.decodeValue(valueBuffer, decodingContext);
for (JoinStatBo candidate : candidates) {
long timestamp = candidate.getTimestamp();
if (this.filter.filter(timestamp)) {
continue;
}
dataPoints.add(candidate);
}
}
}
// Reverse sort as timestamp is stored in a reversed order.
dataPoints.sort(REVERSE_TIMESTAMP_COMPARATOR);
return dataPoints;
}
use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo in project pinpoint by naver.
the class ActiveTraceCodec method encodeValues.
@Override
public void encodeValues(Buffer valueBuffer, List<JoinStatBo> joinActiveTraceBoList) {
if (CollectionUtils.isEmpty(joinActiveTraceBoList)) {
throw new IllegalArgumentException("JoinActiveTraceBoList must not be empty");
}
final int numValues = joinActiveTraceBoList.size();
valueBuffer.putVInt(numValues);
List<Long> timestamps = new ArrayList<>(numValues);
UnsignedShortEncodingStrategy.Analyzer.Builder versionAnalyzerBuilder = new UnsignedShortEncodingStrategy.Analyzer.Builder();
UnsignedIntegerEncodingStrategy.Analyzer.Builder schemaTypeAnalyzerBuilder = new UnsignedIntegerEncodingStrategy.Analyzer.Builder();
JoinIntFieldStrategyAnalyzer.Builder totalCountAnalyzerBuilder = new JoinIntFieldStrategyAnalyzer.Builder();
for (JoinStatBo joinStatBo : joinActiveTraceBoList) {
JoinActiveTraceBo joinActiveTraceBo = (JoinActiveTraceBo) joinStatBo;
timestamps.add(joinActiveTraceBo.getTimestamp());
versionAnalyzerBuilder.addValue(joinActiveTraceBo.getVersion());
schemaTypeAnalyzerBuilder.addValue(joinActiveTraceBo.getHistogramSchemaType());
totalCountAnalyzerBuilder.addValue(joinActiveTraceBo.getTotalCountJoinValue());
}
codec.encodeTimestamps(valueBuffer, timestamps);
encodeDataPoints(valueBuffer, versionAnalyzerBuilder.build(), schemaTypeAnalyzerBuilder.build(), totalCountAnalyzerBuilder.build());
}
Aggregations