use of com.navercorp.pinpoint.common.buffer.Buffer in project pinpoint by naver.
the class TransactionIdUtilsTest method writeTransactionId_for_compatibility.
private static ByteBuffer writeTransactionId_for_compatibility(String agentId, long agentStartTime, long transactionSequence) {
final Buffer buffer = new AutomaticBuffer(1 + 5 + 24 + 10 + 10);
buffer.putByte(TransactionIdUtils.VERSION);
buffer.putPrefixedString(agentId);
buffer.putVLong(agentStartTime);
buffer.putVLong(transactionSequence);
return buffer.wrapByteBuffer();
}
use of com.navercorp.pinpoint.common.buffer.Buffer in project pinpoint by naver.
the class AgentStatEncoder method encodeValue.
public ByteBuffer encodeValue(List<T> agentStatDataPoints) {
Buffer valueBuffer = new AutomaticBuffer();
valueBuffer.putByte(this.codec.getVersion());
codec.encodeValues(valueBuffer, agentStatDataPoints);
return valueBuffer.wrapByteBuffer();
}
use of com.navercorp.pinpoint.common.buffer.Buffer in project pinpoint by naver.
the class ServerMetaDataBo method writeValue.
public byte[] writeValue() {
final Buffer buffer = new AutomaticBuffer();
buffer.put2PrefixedString(this.serverInfo);
final int numVmArgs = this.vmArgs == null ? 0 : this.vmArgs.size();
buffer.putVInt(numVmArgs);
if (this.vmArgs != null) {
for (String vmArg : this.vmArgs) {
buffer.put2PrefixedString(vmArg);
}
}
final int numServiceInfos = this.serviceInfos == null ? 0 : this.serviceInfos.size();
buffer.putVInt(numServiceInfos);
if (this.serviceInfos != null) {
for (ServiceInfoBo serviceInfo : this.serviceInfos) {
buffer.putPrefixedBytes(serviceInfo.writeValue());
}
}
return buffer.getBuffer();
}
use of com.navercorp.pinpoint.common.buffer.Buffer in project pinpoint by naver.
the class AgentInfoBo method writeValue.
public byte[] writeValue() {
final Buffer buffer = new AutomaticBuffer();
buffer.putPrefixedString(this.getHostName());
buffer.putPrefixedString(this.getIp());
buffer.putPrefixedString(this.getPorts());
buffer.putPrefixedString(this.getApplicationName());
buffer.putShort(this.getServiceTypeCode());
buffer.putInt(this.getPid());
buffer.putPrefixedString(this.getAgentVersion());
buffer.putLong(this.getStartTime());
buffer.putLong(this.getEndTimeStamp());
buffer.putInt(this.getEndStatus());
buffer.putPrefixedString(this.getVmVersion());
buffer.putBoolean(this.isContainer());
buffer.putPrefixedString(this.getAgentName());
return buffer.getBuffer();
}
use of com.navercorp.pinpoint.common.buffer.Buffer in project pinpoint by naver.
the class ActiveTraceCodecTest method encodeValuesTest.
@Test
public void encodeValuesTest() {
final String id = "test_app";
final long currentTime = new Date().getTime();
ActiveTraceCodec activeTraceCodec = new ActiveTraceCodec(new AgentStatDataPointCodec());
final Buffer encodedValueBuffer = new AutomaticBuffer();
final List<JoinStatBo> joinActiveTraceBoList = createJoinActiveTRaceBoList(currentTime);
encodedValueBuffer.putByte(activeTraceCodec.getVersion());
activeTraceCodec.encodeValues(encodedValueBuffer, joinActiveTraceBoList);
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(), activeTraceCodec.getVersion());
List<JoinStatBo> decodedJoinActiveTraceBoList = activeTraceCodec.decodeValues(valueBuffer, decodingContext);
for (int i = 0; i < decodedJoinActiveTraceBoList.size(); i++) {
assertEquals(decodedJoinActiveTraceBoList.get(i), joinActiveTraceBoList.get(i));
}
}
Aggregations