Search in sources :

Example 6 with Buffer

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

the class AnnotationTranscoder method encodeIntStringValue.

private byte[] encodeIntStringValue(Object value) {
    final TIntStringValue tIntStringValue = (TIntStringValue) value;
    final int intValue = tIntStringValue.getIntValue();
    final byte[] stringValue = BytesUtils.toBytes(tIntStringValue.getStringValue());
    // TODO increase by a more precise value
    final int bufferSize = getBufferSize(stringValue, 4 + 8);
    final Buffer buffer = new AutomaticBuffer(bufferSize);
    buffer.putSVInt(intValue);
    buffer.putPrefixedBytes(stringValue);
    return buffer.getBuffer();
}
Also used : TIntStringValue(com.navercorp.pinpoint.thrift.dto.TIntStringValue) 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 7 with Buffer

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

the class AnnotationTranscoder method encodeIntStringStringValue.

private byte[] encodeIntStringStringValue(Object o) {
    final TIntStringStringValue tIntStringStringValue = (TIntStringStringValue) o;
    final int intValue = tIntStringStringValue.getIntValue();
    final byte[] stringValue1 = BytesUtils.toBytes(tIntStringStringValue.getStringValue1());
    final byte[] stringValue2 = BytesUtils.toBytes(tIntStringStringValue.getStringValue2());
    // TODO increase by a more precise value
    final int bufferSize = getBufferSize(stringValue1, stringValue2, 4 + 8);
    final Buffer buffer = new AutomaticBuffer(bufferSize);
    buffer.putSVInt(intValue);
    buffer.putPrefixedBytes(stringValue1);
    buffer.putPrefixedBytes(stringValue2);
    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) TIntStringStringValue(com.navercorp.pinpoint.thrift.dto.TIntStringStringValue) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer)

Example 8 with Buffer

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

the class HbaseApplicationTraceIndexDao method insert.

@Override
public void insert(final TSpan span) {
    if (span == null) {
        throw new NullPointerException("span must not be null");
    }
    final Buffer buffer = new AutomaticBuffer(10 + AGENT_NAME_MAX_LEN);
    buffer.putVInt(span.getElapsed());
    buffer.putSVInt(span.getErr());
    buffer.putPrefixedString(span.getAgentId());
    final byte[] value = buffer.getBuffer();
    long acceptedTime = acceptedTimeService.getAcceptedTime();
    final byte[] distributedKey = createRowKey(span, acceptedTime);
    Put put = new Put(distributedKey);
    put.addColumn(APPLICATION_TRACE_INDEX_CF_TRACE, makeQualifier(span), acceptedTime, value);
    boolean success = hbaseTemplate.asyncPut(APPLICATION_TRACE_INDEX, put);
    if (!success) {
        hbaseTemplate.put(APPLICATION_TRACE_INDEX, put);
    }
}
Also used : Buffer(com.navercorp.pinpoint.common.buffer.Buffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) Put(org.apache.hadoop.hbase.client.Put)

Example 9 with Buffer

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

the class ActiveTraceHistogramBo method writeValue.

public byte[] writeValue() {
    final Buffer buffer = new AutomaticBuffer();
    buffer.putByte(this.version);
    buffer.putVInt(this.histogramSchemaType);
    int version = this.version & 0xFF;
    switch(version) {
        case 0:
            buffer.putVInt(this.activeTraceCountMap.size());
            buffer.putVInt(this.activeTraceCountMap.get(SlotType.FAST));
            buffer.putVInt(this.activeTraceCountMap.get(SlotType.NORMAL));
            buffer.putVInt(this.activeTraceCountMap.get(SlotType.SLOW));
            buffer.putVInt(this.activeTraceCountMap.get(SlotType.VERY_SLOW));
            break;
        default:
            break;
    }
    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 10 with Buffer

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

the class AgentStatMemoryGcBo method writeValue.

public byte[] writeValue() {
    final Buffer buffer = new AutomaticBuffer();
    buffer.putPrefixedString(this.agentId);
    buffer.putLong(this.startTimestamp);
    buffer.putLong(this.timestamp);
    buffer.putPrefixedString(this.gcType);
    buffer.putLong(this.jvmMemoryHeapUsed);
    buffer.putLong(this.jvmMemoryHeapMax);
    buffer.putLong(this.jvmMemoryNonHeapUsed);
    buffer.putLong(this.jvmMemoryNonHeapMax);
    buffer.putLong(this.jvmGcOldCount);
    buffer.putLong(this.jvmGcOldTime);
    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)

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