Search in sources :

Example 21 with AutomaticBuffer

use of com.navercorp.pinpoint.common.buffer.AutomaticBuffer in project pinpoint by naver.

the class AgentLifeCycleValueMapper method mapValue.

@Override
public byte[] mapValue(AgentLifeCycleBo value) {
    final Buffer buffer = new AutomaticBuffer();
    buffer.putInt(value.getVersion());
    buffer.putPrefixedString(value.getAgentId());
    buffer.putLong(value.getStartTimestamp());
    buffer.putLong(value.getEventTimestamp());
    buffer.putLong(value.getEventIdentifier());
    buffer.putShort(value.getAgentLifeCycleState().getCode());
    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 22 with AutomaticBuffer

use of com.navercorp.pinpoint.common.buffer.AutomaticBuffer in project pinpoint by naver.

the class HbaseApplicationTraceIndexColumnTest method indexColumnName2.

@Test
public void indexColumnName2() {
    final int elapsed = 1234;
    final byte[] bytes = "thisisbytes".getBytes();
    final Buffer columnName = new AutomaticBuffer(16);
    columnName.putInt(elapsed);
    columnName.putPrefixedBytes(bytes);
}
Also used : Buffer(com.navercorp.pinpoint.common.buffer.Buffer) OffsetFixedBuffer(com.navercorp.pinpoint.common.buffer.OffsetFixedBuffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) Test(org.junit.Test)

Example 23 with AutomaticBuffer

use of com.navercorp.pinpoint.common.buffer.AutomaticBuffer in project pinpoint by naver.

the class HbaseApplicationTraceIndexColumnTest method indexedColumnName.

@Test
public void indexedColumnName() {
    final int elapsed = 1234;
    final String agentId = "agentId";
    final long agentStartTime = 1234567890L;
    final long transactionSequence = 1234567890L;
    // final Buffer buffer= new AutomaticBuffer(32);
    // buffer.putPrefixedString(agentId);
    // buffer.putSVar(transactionId.getAgentStartTime());
    // buffer.putVar(transactionId.getTransactionSequence());
    // return buffer.getBuffer();
    final Buffer originalBuffer = new AutomaticBuffer(16);
    originalBuffer.putVInt(elapsed);
    originalBuffer.putPrefixedString(agentId);
    originalBuffer.putSVLong(agentStartTime);
    originalBuffer.putVLong(transactionSequence);
    byte[] source = originalBuffer.getBuffer();
    final Buffer fetched = new OffsetFixedBuffer(source);
    Assert.assertEquals(elapsed, fetched.readVInt());
    Assert.assertEquals(agentId, fetched.readPrefixedString());
    Assert.assertEquals(agentStartTime, fetched.readSVLong());
    Assert.assertEquals(transactionSequence, fetched.readVLong());
}
Also used : Buffer(com.navercorp.pinpoint.common.buffer.Buffer) OffsetFixedBuffer(com.navercorp.pinpoint.common.buffer.OffsetFixedBuffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) OffsetFixedBuffer(com.navercorp.pinpoint.common.buffer.OffsetFixedBuffer) Test(org.junit.Test)

Example 24 with AutomaticBuffer

use of com.navercorp.pinpoint.common.buffer.AutomaticBuffer in project pinpoint by naver.

the class SpanEventSerializer method writeQualifier.

private ByteBuffer writeQualifier(SpanEventEncodingContext spanEventEncodingContext) {
    SpanEventBo spanEventBo = spanEventEncodingContext.getSpanEventBo();
    BasicSpan basicSpan = spanEventEncodingContext.getBasicSpan();
    final Buffer rowId = new AutomaticBuffer();
    rowId.putLong(basicSpan.getSpanId());
    rowId.putShort(spanEventBo.getSequence());
    rowId.putInt(spanEventBo.getAsyncId());
    rowId.putShort(spanEventBo.getAsyncSequence());
    return rowId.wrapByteBuffer();
}
Also used : Buffer(com.navercorp.pinpoint.common.buffer.Buffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) ByteBuffer(java.nio.ByteBuffer) BasicSpan(com.navercorp.pinpoint.common.server.bo.BasicSpan) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo)

Example 25 with AutomaticBuffer

use of com.navercorp.pinpoint.common.buffer.AutomaticBuffer in project pinpoint by naver.

the class SpanEventSerializer method writeValue.

public ByteBuffer writeValue(SpanEventEncodingContext spanEventEncodingContext) {
    SpanEventBo spanEventBo = spanEventEncodingContext.getSpanEventBo();
    BasicSpan basicSpan = spanEventEncodingContext.getBasicSpan();
    final Buffer buffer = new AutomaticBuffer(512);
    buffer.putByte(spanEventBo.getVersion());
    buffer.putPrefixedString(basicSpan.getAgentId());
    buffer.putPrefixedString(basicSpan.getApplicationId());
    buffer.putVLong(basicSpan.getAgentStartTime());
    buffer.putVInt(spanEventBo.getStartElapsed());
    buffer.putVInt(spanEventBo.getEndElapsed());
    // don't need to put sequence because it is set at Qualifier
    // buffer.put(sequence);
    buffer.putPrefixedString(spanEventBo.getRpc());
    buffer.putShort(spanEventBo.getServiceType());
    buffer.putPrefixedString(spanEventBo.getEndPoint());
    buffer.putPrefixedString(spanEventBo.getDestinationId());
    buffer.putSVInt(spanEventBo.getApiId());
    buffer.putSVInt(spanEventBo.getDepth());
    buffer.putLong(spanEventBo.getNextSpanId());
    if (spanEventBo.hasException()) {
        buffer.putBoolean(true);
        buffer.putSVInt(spanEventBo.getExceptionId());
        buffer.putPrefixedString(spanEventBo.getExceptionMessage());
    } else {
        buffer.putBoolean(false);
    }
    final List<AnnotationBo> annotationBoList = spanEventBo.getAnnotationBoList();
    this.annotationSerializer.writeAnnotationList(annotationBoList, buffer);
    buffer.putSVInt(spanEventBo.getNextAsyncId());
    return buffer.wrapByteBuffer();
}
Also used : Buffer(com.navercorp.pinpoint.common.buffer.Buffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) ByteBuffer(java.nio.ByteBuffer) AnnotationBo(com.navercorp.pinpoint.common.server.bo.AnnotationBo) BasicSpan(com.navercorp.pinpoint.common.server.bo.BasicSpan) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo)

Aggregations

AutomaticBuffer (com.navercorp.pinpoint.common.buffer.AutomaticBuffer)39 Buffer (com.navercorp.pinpoint.common.buffer.Buffer)39 FixedBuffer (com.navercorp.pinpoint.common.buffer.FixedBuffer)13 ByteBuffer (java.nio.ByteBuffer)9 Test (org.junit.Test)6 SpanEventBo (com.navercorp.pinpoint.common.server.bo.SpanEventBo)4 AnnotationBo (com.navercorp.pinpoint.common.server.bo.AnnotationBo)3 OffsetFixedBuffer (com.navercorp.pinpoint.common.buffer.OffsetFixedBuffer)2 BasicSpan (com.navercorp.pinpoint.common.server.bo.BasicSpan)2 Put (org.apache.hadoop.hbase.client.Put)2 ApiMetaDataBo (com.navercorp.pinpoint.common.server.bo.ApiMetaDataBo)1 SpanBo (com.navercorp.pinpoint.common.server.bo.SpanBo)1 SpanChunkBo (com.navercorp.pinpoint.common.server.bo.SpanChunkBo)1 EncodingStrategy (com.navercorp.pinpoint.common.server.bo.codec.strategy.EncodingStrategy)1 AgentStatDecodingContext (com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatDecodingContext)1 SpanBitFiled (com.navercorp.pinpoint.common.server.bo.serializer.trace.v2.bitfield.SpanBitFiled)1 AgentStatDataPoint (com.navercorp.pinpoint.common.server.bo.stat.AgentStatDataPoint)1 HistogramSlot (com.navercorp.pinpoint.common.trace.HistogramSlot)1 TransactionId (com.navercorp.pinpoint.common.util.TransactionId)1 TIntStringStringValue (com.navercorp.pinpoint.thrift.dto.TIntStringStringValue)1