Search in sources :

Example 31 with AutomaticBuffer

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

the class SpanUtils method getVarTransactionId.

public static byte[] getVarTransactionId(TSpan span) {
    if (span == null) {
        throw new NullPointerException("span must not be null");
    }
    final byte[] transactionIdBytes = span.getTransactionId();
    TransactionId transactionId = TransactionIdUtils.parseTransactionId(transactionIdBytes);
    String agentId = transactionId.getAgentId();
    if (agentId == null) {
        agentId = span.getAgentId();
    }
    final Buffer buffer = new AutomaticBuffer(32);
    buffer.putPrefixedString(agentId);
    buffer.putSVLong(transactionId.getAgentStartTime());
    buffer.putVLong(transactionId.getTransactionSequence());
    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) TransactionId(com.navercorp.pinpoint.common.util.TransactionId)

Example 32 with AutomaticBuffer

use of com.navercorp.pinpoint.common.buffer.AutomaticBuffer 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());
    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 33 with AutomaticBuffer

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

the class AgentStatCpuLoadBo method writeValue.

public byte[] writeValue() {
    final Buffer buffer = new AutomaticBuffer();
    buffer.putPrefixedString(this.agentId);
    buffer.putLong(this.startTimestamp);
    buffer.putLong(this.timestamp);
    buffer.putDouble(this.jvmCpuLoad);
    buffer.putDouble(this.systemCpuLoad);
    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 34 with AutomaticBuffer

use of com.navercorp.pinpoint.common.buffer.AutomaticBuffer 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 35 with AutomaticBuffer

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

the class EncodingStrategyTestBase method getBufferSizes.

private Map<EncodingStrategy<T>, Integer> getBufferSizes(List<T> values) {
    Map<EncodingStrategy<T>, Integer> bufferSizes = new HashMap<EncodingStrategy<T>, Integer>();
    for (EncodingStrategy<T> strategy : getEncodingStrategies()) {
        Buffer encodedBuffer = new AutomaticBuffer();
        codec.encodeValues(encodedBuffer, strategy, values);
        int encodedBufferSize = encodedBuffer.getBuffer().length;
        bufferSizes.put(strategy, encodedBufferSize);
    }
    logger.debug("Strategies : {}", bufferSizes);
    return bufferSizes;
}
Also used : Buffer(com.navercorp.pinpoint.common.buffer.Buffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) HashMap(java.util.HashMap) EncodingStrategy(com.navercorp.pinpoint.common.server.bo.codec.strategy.EncodingStrategy) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer)

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