Search in sources :

Example 76 with Buffer

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();
}
Also used : Buffer(com.navercorp.pinpoint.common.buffer.Buffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) ByteBuffer(java.nio.ByteBuffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer)

Example 77 with Buffer

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();
}
Also used : Buffer(com.navercorp.pinpoint.common.buffer.Buffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) ByteBuffer(java.nio.ByteBuffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer)

Example 78 with Buffer

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();
}
Also used : FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer) Buffer(com.navercorp.pinpoint.common.buffer.Buffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer)

Example 79 with Buffer

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();
}
Also used : Buffer(com.navercorp.pinpoint.common.buffer.Buffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer)

Example 80 with Buffer

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));
    }
}
Also used : FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer) Buffer(com.navercorp.pinpoint.common.buffer.Buffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer) ApplicationStatDecodingContext(com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatDecodingContext) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) JoinStatBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo) Date(java.util.Date) AgentStatDataPointCodec(com.navercorp.pinpoint.common.server.bo.codec.stat.AgentStatDataPointCodec) Test(org.junit.Test)

Aggregations

Buffer (com.navercorp.pinpoint.common.buffer.Buffer)107 AutomaticBuffer (com.navercorp.pinpoint.common.buffer.AutomaticBuffer)76 FixedBuffer (com.navercorp.pinpoint.common.buffer.FixedBuffer)57 ByteBuffer (java.nio.ByteBuffer)27 Test (org.junit.Test)24 OffsetFixedBuffer (com.navercorp.pinpoint.common.buffer.OffsetFixedBuffer)15 ApplicationStatDecodingContext (com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatDecodingContext)11 JoinStatBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo)11 AgentStatDataPointCodec (com.navercorp.pinpoint.common.server.bo.codec.stat.AgentStatDataPointCodec)10 Date (java.util.Date)10 SpanEventBo (com.navercorp.pinpoint.common.server.bo.SpanEventBo)9 Cell (org.apache.hadoop.hbase.Cell)9 SpanBo (com.navercorp.pinpoint.common.server.bo.SpanBo)8 ArrayList (java.util.ArrayList)6 AnnotationBo (com.navercorp.pinpoint.common.server.bo.AnnotationBo)5 TransactionId (com.navercorp.pinpoint.common.profiler.util.TransactionId)4 IntStringStringValue (com.navercorp.pinpoint.common.util.IntStringStringValue)4 TransactionId (com.navercorp.pinpoint.common.util.TransactionId)4 Put (org.apache.hadoop.hbase.client.Put)4 SpanChunkBo (com.navercorp.pinpoint.common.server.bo.SpanChunkBo)3