Search in sources :

Example 36 with Buffer

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

the class SpanUtils method getVarTransactionId.

public static byte[] getVarTransactionId(SpanBo span) {
    Objects.requireNonNull(span, "span");
    final TransactionId transactionId = span.getTransactionId();
    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.profiler.util.TransactionId)

Example 37 with Buffer

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

the class HbaseHostApplicationMapDao method createKey.

private byte[] createKey(Application parentApplication, long time) {
    Buffer buffer = new AutomaticBuffer();
    buffer.putPadString(parentApplication.getName(), HbaseTableConstants.APPLICATION_NAME_MAX_LEN);
    buffer.putShort(parentApplication.getServiceTypeCode());
    buffer.putLong(time);
    return buffer.getBuffer();
}
Also used : AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) Buffer(com.navercorp.pinpoint.common.buffer.Buffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer)

Example 38 with Buffer

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

the class AgentEventValueMapper method mapValue.

@Override
public byte[] mapValue(AgentEventBo value) {
    final Buffer buffer = new AutomaticBuffer();
    buffer.putInt(value.getVersion());
    buffer.putPrefixedString(value.getAgentId());
    buffer.putLong(value.getStartTimestamp());
    buffer.putLong(value.getEventTimestamp());
    buffer.putPrefixedBytes(value.getEventBody());
    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 39 with Buffer

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

the class AgentInfoMapper method createBuilderFromValue.

private AgentInfoBo.Builder createBuilderFromValue(byte[] serializedAgentInfo) {
    final Buffer buffer = new FixedBuffer(serializedAgentInfo);
    final AgentInfoBo.Builder builder = new AgentInfoBo.Builder();
    builder.setHostName(buffer.readPrefixedString());
    builder.setIp(buffer.readPrefixedString());
    builder.setPorts(buffer.readPrefixedString());
    builder.setApplicationName(buffer.readPrefixedString());
    builder.setServiceTypeCode(buffer.readShort());
    builder.setPid(buffer.readInt());
    builder.setAgentVersion(buffer.readPrefixedString());
    builder.setStartTime(buffer.readLong());
    builder.setEndTimeStamp(buffer.readLong());
    builder.setEndStatus(buffer.readInt());
    // FIXME - 2015.09 v1.5.0 added vmVersion (check for compatibility)
    if (buffer.hasRemaining()) {
        builder.setVmVersion(buffer.readPrefixedString());
    }
    // FIXME - 2018.06 v1.8.0 added container (check for compatibility)
    if (buffer.hasRemaining()) {
        builder.isContainer(buffer.readBoolean());
    }
    // 2021.03.24 added agent name
    if (buffer.hasRemaining()) {
        builder.setAgentName(buffer.readPrefixedString());
    }
    return builder;
}
Also used : FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer) Buffer(com.navercorp.pinpoint.common.buffer.Buffer) AgentInfoBo(com.navercorp.pinpoint.common.server.bo.AgentInfoBo) FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer)

Example 40 with Buffer

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

the class HbaseHostApplicationMapDao method createRowKey0.

@VisibleForTesting
static byte[] createRowKey0(String parentApplicationName, short parentServiceType, long statisticsRowSlot, String parentAgentId) {
    // even if  a agentId be added for additional specifications, it may be safe to scan rows.
    // But is it needed to add parentAgentServiceType?
    final int SIZE = HbaseTableConstants.APPLICATION_NAME_MAX_LEN + 2 + 8;
    final Buffer rowKeyBuffer = new AutomaticBuffer(SIZE);
    rowKeyBuffer.putPadString(parentApplicationName, HbaseTableConstants.APPLICATION_NAME_MAX_LEN);
    rowKeyBuffer.putShort(parentServiceType);
    rowKeyBuffer.putLong(TimeUtils.reverseTimeMillis(statisticsRowSlot));
    // rowKeyBuffer.putPadString(parentAgentId, HbaseTableConstants.AGENT_NAME_MAX_LEN);
    return rowKeyBuffer.getBuffer();
}
Also used : Buffer(com.navercorp.pinpoint.common.buffer.Buffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) VisibleForTesting(com.navercorp.pinpoint.common.annotations.VisibleForTesting)

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