use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinResponseTimeBo in project pinpoint by naver.
the class JoinResponseTimeSampler method sampleDataPoints.
@Override
public AggreJoinResponseTimeBo sampleDataPoints(int index, long timestamp, List<JoinResponseTimeBo> joinResponseTimeBoList, JoinResponseTimeBo previousDataPoint) {
if (CollectionUtils.isEmpty(joinResponseTimeBoList)) {
return AggreJoinResponseTimeBo.createUncollectedObject(timestamp);
}
JoinResponseTimeBo joinResponseTimeBo = JoinResponseTimeBo.joinResponseTimeBoList(joinResponseTimeBoList, timestamp);
String id = joinResponseTimeBo.getId();
JoinLongFieldBo responseTimeJoinValue = joinResponseTimeBo.getResponseTimeJoinValue();
AggreJoinResponseTimeBo aggreJoinResponseTimeBo = new AggreJoinResponseTimeBo(id, timestamp, responseTimeJoinValue);
return aggreJoinResponseTimeBo;
}
use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinResponseTimeBo in project pinpoint by naver.
the class ResponseTimeCodecTest method createJoinResponseTimeBoList.
private List<JoinStatBo> createJoinResponseTimeBoList(long currentTime) {
final String id = "test_app";
List<JoinStatBo> joinResponseTimeBoList = new ArrayList<>();
JoinResponseTimeBo joinResponseTimeBo1 = new JoinResponseTimeBo(id, currentTime, 3000, 2, "app_1_1", 6000, "app_1_2");
JoinResponseTimeBo joinResponseTimeBo2 = new JoinResponseTimeBo(id, currentTime + 5000, 4000, 200, "app_2_1", 9000, "app_2_2");
JoinResponseTimeBo joinResponseTimeBo3 = new JoinResponseTimeBo(id, currentTime + 10000, 2000, 20, "app_3_1", 7000, "app_3_2");
JoinResponseTimeBo joinResponseTimeBo4 = new JoinResponseTimeBo(id, currentTime + 15000, 5000, 20, "app_4_1", 8000, "app_4_2");
JoinResponseTimeBo joinResponseTimeBo5 = new JoinResponseTimeBo(id, currentTime + 20000, 1000, 10, "app_5_1", 6600, "app_5_2");
joinResponseTimeBoList.add(joinResponseTimeBo1);
joinResponseTimeBoList.add(joinResponseTimeBo2);
joinResponseTimeBoList.add(joinResponseTimeBo3);
joinResponseTimeBoList.add(joinResponseTimeBo4);
joinResponseTimeBoList.add(joinResponseTimeBo5);
return joinResponseTimeBoList;
}
use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinResponseTimeBo in project pinpoint by naver.
the class JoinResponseTimeSamplerTest method sampleDataPointsTest.
@Test
public void sampleDataPointsTest() {
long currentTime = 1487149800000L;
JoinResponseTimeSampler joinResponseTimeSampler = new JoinResponseTimeSampler();
List<JoinResponseTimeBo> joinResponseTimeBoList = createJoinResponseTimeList(currentTime);
AggreJoinResponseTimeBo aggreJoinResponseTimeBo = joinResponseTimeSampler.sampleDataPoints(1, currentTime, joinResponseTimeBoList, JoinResponseTimeBo.EMPTY_JOIN_RESPONSE_TIME_BO);
assertEquals(aggreJoinResponseTimeBo.getId(), "test_app");
assertEquals(aggreJoinResponseTimeBo.getTimestamp(), 1487149800000L);
assertEquals(aggreJoinResponseTimeBo.getResponseTimeJoinValue(), new JoinLongFieldBo(3000L, 2L, "app_1_1", 9000L, "app_2_1"));
}
use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinResponseTimeBo in project pinpoint by naver.
the class ResponseTimeCodec method encodeValues.
@Override
public void encodeValues(Buffer valueBuffer, List<JoinStatBo> joinResponseTimeBoList) {
if (CollectionUtils.isEmpty(joinResponseTimeBoList)) {
throw new IllegalArgumentException("joinResponseTimeBoList must not be empty");
}
final int numValues = joinResponseTimeBoList.size();
valueBuffer.putVInt(numValues);
List<Long> timestamps = new ArrayList<Long>(numValues);
JoinLongFieldStrategyAnalyzer.Builder responseTimeAnalyzerBuilder = new JoinLongFieldStrategyAnalyzer.Builder();
for (JoinStatBo joinStatBo : joinResponseTimeBoList) {
JoinResponseTimeBo joinResponseTimeBo = (JoinResponseTimeBo) joinStatBo;
timestamps.add(joinResponseTimeBo.getTimestamp());
responseTimeAnalyzerBuilder.addValue(joinResponseTimeBo.getResponseTimeJoinValue());
}
codec.encodeTimestamps(valueBuffer, timestamps);
encodeDataPoints(valueBuffer, responseTimeAnalyzerBuilder.build());
}
use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinResponseTimeBo in project pinpoint by naver.
the class ResponseTimeCodec 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 responseTimeEncodingStrategy = JoinLongFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode());
final List<JoinLongFieldBo> responseTimeList = this.codec.decodeValues(valueBuffer, responseTimeEncodingStrategy, numValues);
List<JoinStatBo> joinResponseTimeBoList = new ArrayList<JoinStatBo>();
for (int i = 0; i < numValues; i++) {
JoinResponseTimeBo joinResponseTimeBo = new JoinResponseTimeBo();
joinResponseTimeBo.setId(id);
joinResponseTimeBo.setTimestamp(timestampList.get(i));
joinResponseTimeBo.setResponseTimeJoinValue(responseTimeList.get(i));
joinResponseTimeBoList.add(joinResponseTimeBo);
}
return joinResponseTimeBoList;
}
Aggregations