use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo in project pinpoint by naver.
the class ApplicationStatHbaseOperationFactory method createPuts.
public List<Put> createPuts(String applicationId, List<JoinStatBo> joinStatBoList, StatType statType, ApplicationStatSerializer applicationStatSerializer) {
if (CollectionUtils.isEmpty(joinStatBoList)) {
return Collections.emptyList();
}
Map<Long, List<JoinStatBo>> timeslots = slotApplicationStatDataPoints(joinStatBoList);
List<Put> puts = new ArrayList<>();
for (Map.Entry<Long, List<JoinStatBo>> timeslot : timeslots.entrySet()) {
long baseTimestamp = timeslot.getKey();
List<JoinStatBo> slottedApplicationStatDataPoints = timeslot.getValue();
final ApplicationStatRowKeyComponent rowKeyComponent = new ApplicationStatRowKeyComponent(applicationId, statType, baseTimestamp);
byte[] rowKey = this.rowKeyEncoder.encodeRowKey(rowKeyComponent);
byte[] distributedRowKey = this.rowKeyDistributor.getDistributedKey(rowKey);
Put put = new Put(distributedRowKey);
applicationStatSerializer.serialize(slottedApplicationStatDataPoints, put, null);
puts.add(put);
}
return puts;
}
use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo in project pinpoint by naver.
the class ActiveTraceCodecTest method createJoinActiveTRaceBoList.
private List<JoinStatBo> createJoinActiveTRaceBoList(long currentTime) {
final String id = "test_app";
List<JoinStatBo> joinActiveTraceBoList = new ArrayList<JoinStatBo>();
JoinActiveTraceBo joinActiveTraceBo1 = new JoinActiveTraceBo(id, 1, (short) 2, 31, 11, "app_1_1", 41, "app_1_2", currentTime);
JoinActiveTraceBo joinActiveTraceBo2 = new JoinActiveTraceBo(id, 1, (short) 2, 32, 12, "app_2_1", 42, "app_2_2", currentTime + 5000);
JoinActiveTraceBo joinActiveTraceBo3 = new JoinActiveTraceBo(id, 1, (short) 2, 33, 13, "app_3_1", 43, "app_3_2", currentTime + 10000);
JoinActiveTraceBo joinActiveTraceBo4 = new JoinActiveTraceBo(id, 1, (short) 2, 34, 14, "app_4_1", 44, "app_4_2", currentTime + 15000);
JoinActiveTraceBo joinActiveTraceBo5 = new JoinActiveTraceBo(id, 1, (short) 2, 35, 15, "app_5_1", 45, "app_5_2", currentTime + 20000);
joinActiveTraceBoList.add(joinActiveTraceBo1);
joinActiveTraceBoList.add(joinActiveTraceBo2);
joinActiveTraceBoList.add(joinActiveTraceBo3);
joinActiveTraceBoList.add(joinActiveTraceBo4);
joinActiveTraceBoList.add(joinActiveTraceBo5);
return joinActiveTraceBoList;
}
use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo in project pinpoint by naver.
the class DataSourceCodecTest method encodeAndDecodeTest.
@Test
public void encodeAndDecodeTest() {
final String id = "test_app";
final long currentTime = new Date().getTime();
final AgentStatDataPointCodec agentStatDataPointCodec = new AgentStatDataPointCodec();
final DataSourceCodec dataSourceCodec = new DataSourceCodec(agentStatDataPointCodec);
final List<JoinStatBo> joinDataSourceListBoList = createJoinDataSourceListBoList(currentTime);
final Buffer encodedValueBuffer = new AutomaticBuffer();
encodedValueBuffer.putByte(dataSourceCodec.getVersion());
dataSourceCodec.encodeValues(encodedValueBuffer, joinDataSourceListBoList);
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(), dataSourceCodec.getVersion());
List<JoinStatBo> decodedJoinDataSourceListBoList = dataSourceCodec.decodeValues(valueBuffer, decodingContext);
for (int i = 0; i < decodedJoinDataSourceListBoList.size(); ++i) {
assertEquals(decodedJoinDataSourceListBoList.get(i), joinDataSourceListBoList.get(i));
}
}
use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo in project pinpoint by naver.
the class CpuLoadCodecTest method encodeAndDecodeTest.
@Test
public void encodeAndDecodeTest() {
final String id = "test_app";
final long currentTime = new Date().getTime();
final AgentStatDataPointCodec agentStatDataPointCodec = new AgentStatDataPointCodec();
final CpuLoadCodec cpuLoadCodec = new CpuLoadCodec(agentStatDataPointCodec);
final Buffer encodedValueBuffer = new AutomaticBuffer();
final List<JoinStatBo> joinCpuLoadBoList = createJoinCpuLoadBoList(currentTime);
encodedValueBuffer.putByte(cpuLoadCodec.getVersion());
cpuLoadCodec.encodeValues(encodedValueBuffer, joinCpuLoadBoList);
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(), cpuLoadCodec.getVersion());
List<JoinStatBo> decodedjoinCpuLoadBoList = cpuLoadCodec.decodeValues(valueBuffer, decodingContext);
for (int i = 0; i < decodedjoinCpuLoadBoList.size(); i++) {
assertEquals(decodedjoinCpuLoadBoList.get(i), joinCpuLoadBoList.get(i));
}
}
use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo in project pinpoint by naver.
the class DirectBufferCodecTest method encodeAndDecodeTest.
@Test
public void encodeAndDecodeTest() {
final String id = "test_app";
final long currentTime = new Date().getTime();
final AgentStatDataPointCodec agentStatDataPointCodec = new AgentStatDataPointCodec();
final DirectBufferCodec directBufferCodec = new DirectBufferCodec(agentStatDataPointCodec);
final Buffer encodedValueBuffer = new AutomaticBuffer();
final List<JoinStatBo> joinDirectBufferBoList = createJoinDirectBufferBoList(currentTime);
encodedValueBuffer.putByte(directBufferCodec.getVersion());
directBufferCodec.encodeValues(encodedValueBuffer, joinDirectBufferBoList);
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(), directBufferCodec.getVersion());
List<JoinStatBo> decodedJoinDirectBufferBoList = directBufferCodec.decodeValues(valueBuffer, decodingContext);
for (int i = 0; i < decodedJoinDirectBufferBoList.size(); i++) {
assertEquals(decodedJoinDirectBufferBoList.get(i), joinDirectBufferBoList.get(i));
}
}
Aggregations