use of com.navercorp.pinpoint.common.server.bo.stat.EachUriStatBo in project pinpoint by naver.
the class AgentUriStatSamplerTest method createEachUriStatBo.
private EachUriStatBo createEachUriStatBo(String agentId, long startTimestamp, long timestamp, String uri) {
EachUriStatBo eachUriStatBo = new EachUriStatBo();
eachUriStatBo.setAgentId(agentId);
eachUriStatBo.setStartTimestamp(startTimestamp);
eachUriStatBo.setTimestamp(timestamp);
eachUriStatBo.setUri(uri);
eachUriStatBo.setTotalHistogram(createUriStatHistogram(ThreadLocalRandom.current().nextInt(1, 10)));
return eachUriStatBo;
}
use of com.navercorp.pinpoint.common.server.bo.stat.EachUriStatBo in project pinpoint by naver.
the class GrpcAgentUriStatMapper method map.
public AgentUriStatBo map(final PAgentUriStat agentUriStat) {
final Header agentInfo = ServerContext.getAgentInfo();
final String agentId = agentInfo.getAgentId();
final long startTimestamp = agentInfo.getAgentStartTime();
long timestamp = agentUriStat.getTimestamp();
int bucketVersion = agentUriStat.getBucketVersion();
AgentUriStatBo agentUriStatBo = new AgentUriStatBo();
agentUriStatBo.setAgentId(agentId);
agentUriStatBo.setStartTimestamp(startTimestamp);
agentUriStatBo.setTimestamp(timestamp);
agentUriStatBo.setBucketVersion((byte) bucketVersion);
List<PEachUriStat> eachUriStatList = agentUriStat.getEachUriStatList();
for (PEachUriStat pEachUriStat : eachUriStatList) {
EachUriStatBo eachUriStatBo = createEachUriStatBo(pEachUriStat);
agentUriStatBo.addEachUriStatBo(eachUriStatBo);
}
return agentUriStatBo;
}
use of com.navercorp.pinpoint.common.server.bo.stat.EachUriStatBo in project pinpoint by naver.
the class AgentUriStatSamplerTest method assertHistogramValue.
private void assertHistogramValue(int[] uriStatHistogramValue, List<EachUriStatBo> actual) {
int[] newArrayValue = new int[UriStatHistogramBucket.getBucketSize()];
for (EachUriStatBo eachUriStatBo : actual) {
int[] timestampHistogram = eachUriStatBo.getTotalHistogram().getTimestampHistogram();
for (int i = 0; i < timestampHistogram.length; i++) {
newArrayValue[i] += timestampHistogram[i];
}
}
Assert.assertTrue(Arrays.equals(uriStatHistogramValue, newArrayValue));
}
use of com.navercorp.pinpoint.common.server.bo.stat.EachUriStatBo in project pinpoint by naver.
the class AgentUriStatCodecV2 method encodeValues.
@Override
public void encodeValues(Buffer valueBuffer, List<AgentUriStatBo> agentUriStatBoList) {
final int numValues = CollectionUtils.nullSafeSize(agentUriStatBoList);
if (numValues != 1) {
return;
}
AgentUriStatBo agentUriStatBo = agentUriStatBoList.get(0);
long startTimestamp = agentUriStatBo.getStartTimestamp();
valueBuffer.putVLong(startTimestamp);
long timestamp = agentUriStatBo.getTimestamp();
valueBuffer.putVLong(timestamp);
byte bucketVersion = agentUriStatBo.getBucketVersion();
valueBuffer.putByte(bucketVersion);
List<EachUriStatBo> eachUriStatBoList = agentUriStatBo.getEachUriStatBoList();
int eachUriStatBoSize = CollectionUtils.nullSafeSize(eachUriStatBoList);
valueBuffer.putVInt(eachUriStatBoSize);
EachUriStatCodecV2 eachUriStatCodecV2 = new EachUriStatCodecV2(codec);
eachUriStatCodecV2.encodeValues(valueBuffer, eachUriStatBoList);
}
use of com.navercorp.pinpoint.common.server.bo.stat.EachUriStatBo in project pinpoint by naver.
the class AgentUriStatCodecV2 method decodeValues.
@Override
public List<AgentUriStatBo> decodeValues(Buffer valueBuffer, AgentStatDecodingContext decodingContext) {
AgentUriStatBo agentUriStatBo = new AgentUriStatBo();
final String agentId = decodingContext.getAgentId();
agentUriStatBo.setAgentId(agentId);
final long startTimeStamp = valueBuffer.readVLong();
agentUriStatBo.setStartTimestamp(startTimeStamp);
final long timestamp = valueBuffer.readVLong();
agentUriStatBo.setTimestamp(timestamp);
final byte bucketVersion = valueBuffer.readByte();
agentUriStatBo.setBucketVersion(bucketVersion);
EachUriStatCodecV2 eachUriStatCodecV2 = new EachUriStatCodecV2(codec);
List<EachUriStatBo> eachUriStatBoList = eachUriStatCodecV2.decodeValues(valueBuffer, decodingContext);
agentUriStatBo.addAllEachUriStatBo(eachUriStatBoList);
return Arrays.asList(agentUriStatBo);
}
Aggregations