Search in sources :

Example 1 with LongIntIntByteByteStringValue

use of com.navercorp.pinpoint.common.util.LongIntIntByteByteStringValue in project pinpoint by naver.

the class GrpcAnnotationValueMapper method newLongIntIntByteByteStringValue.

public PLongIntIntByteByteStringValue newLongIntIntByteByteStringValue(LongIntIntByteByteStringValue v) {
    final PLongIntIntByteByteStringValue.Builder builder = this.longIntIntByteByteStringBuilder;
    builder.setLongValue(v.getLongValue());
    builder.setIntValue1(v.getIntValue1());
    if (v.getIntValue2() != -1) {
        builder.setIntValue2(v.getIntValue2());
    }
    if (v.getByteValue1() != -1) {
        builder.setByteValue1(v.getByteValue1());
    }
    if (v.getByteValue2() != -1) {
        builder.setByteValue2(v.getByteValue2());
    }
    if (v.getStringValue() != null) {
        StringValue stringValue = newStringValue(v.getStringValue());
        builder.setStringValue(stringValue);
    }
    PLongIntIntByteByteStringValue value = builder.build();
    builder.clear();
    return value;
}
Also used : PLongIntIntByteByteStringValue(com.navercorp.pinpoint.grpc.trace.PLongIntIntByteByteStringValue) IntStringValue(com.navercorp.pinpoint.common.util.IntStringValue) PStringStringValue(com.navercorp.pinpoint.grpc.trace.PStringStringValue) StringStringValue(com.navercorp.pinpoint.common.util.StringStringValue) PIntStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringValue) StringValue(com.google.protobuf.StringValue) PLongIntIntByteByteStringValue(com.navercorp.pinpoint.grpc.trace.PLongIntIntByteByteStringValue) IntStringStringValue(com.navercorp.pinpoint.common.util.IntStringStringValue) PIntStringStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringStringValue) LongIntIntByteByteStringValue(com.navercorp.pinpoint.common.util.LongIntIntByteByteStringValue)

Example 2 with LongIntIntByteByteStringValue

use of com.navercorp.pinpoint.common.util.LongIntIntByteByteStringValue in project pinpoint by naver.

the class DataTypeAnnotation method apply.

@Override
public PAnnotationValue apply(GrpcAnnotationValueMapper context) {
    PAnnotationValue.Builder builder = context.getAnnotationBuilder();
    final DataType dataType = this.value;
    if (dataType instanceof IntStringValue) {
        final IntStringValue v = (IntStringValue) dataType;
        PIntStringValue pIntStringValue = context.newIntStringValue(v);
        builder.setIntStringValue(pIntStringValue);
        return builder.build();
    } else if (dataType instanceof StringStringValue) {
        final StringStringValue v = (StringStringValue) dataType;
        PStringStringValue pStringStringValue = context.newStringStringValue(v);
        builder.setStringStringValue(pStringStringValue);
        return builder.build();
    } else if (dataType instanceof IntStringStringValue) {
        final IntStringStringValue v = (IntStringStringValue) dataType;
        final PIntStringStringValue pIntStringStringValue = context.newIntStringStringValue(v);
        builder.setIntStringStringValue(pIntStringStringValue);
        return builder.build();
    } else if (dataType instanceof LongIntIntByteByteStringValue) {
        final LongIntIntByteByteStringValue v = (LongIntIntByteByteStringValue) dataType;
        final PLongIntIntByteByteStringValue pValue = context.newLongIntIntByteByteStringValue(v);
        builder.setLongIntIntByteByteStringValue(pValue);
        return builder.build();
    } else if (dataType instanceof IntBooleanIntBooleanValue) {
        final IntBooleanIntBooleanValue v = (IntBooleanIntBooleanValue) dataType;
        final PIntBooleanIntBooleanValue pValue = context.newIntBooleanIntBooleanValue(v);
        builder.setIntBooleanIntBooleanValue(pValue);
        return builder.build();
    }
    throw new UnsupportedOperationException("unsupported type:" + dataType);
}
Also used : PAnnotationValue(com.navercorp.pinpoint.grpc.trace.PAnnotationValue) IntBooleanIntBooleanValue(com.navercorp.pinpoint.common.util.IntBooleanIntBooleanValue) PIntBooleanIntBooleanValue(com.navercorp.pinpoint.grpc.trace.PIntBooleanIntBooleanValue) TIntBooleanIntBooleanValue(com.navercorp.pinpoint.thrift.dto.TIntBooleanIntBooleanValue) PLongIntIntByteByteStringValue(com.navercorp.pinpoint.grpc.trace.PLongIntIntByteByteStringValue) TLongIntIntByteByteStringValue(com.navercorp.pinpoint.thrift.dto.TLongIntIntByteByteStringValue) PLongIntIntByteByteStringValue(com.navercorp.pinpoint.grpc.trace.PLongIntIntByteByteStringValue) LongIntIntByteByteStringValue(com.navercorp.pinpoint.common.util.LongIntIntByteByteStringValue) PIntBooleanIntBooleanValue(com.navercorp.pinpoint.grpc.trace.PIntBooleanIntBooleanValue) PStringStringValue(com.navercorp.pinpoint.grpc.trace.PStringStringValue) PIntStringStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringStringValue) IntStringStringValue(com.navercorp.pinpoint.common.util.IntStringStringValue) PIntStringStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringStringValue) TIntStringStringValue(com.navercorp.pinpoint.thrift.dto.TIntStringStringValue) PStringStringValue(com.navercorp.pinpoint.grpc.trace.PStringStringValue) StringStringValue(com.navercorp.pinpoint.common.util.StringStringValue) IntStringStringValue(com.navercorp.pinpoint.common.util.IntStringStringValue) PIntStringStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringStringValue) TStringStringValue(com.navercorp.pinpoint.thrift.dto.TStringStringValue) TIntStringStringValue(com.navercorp.pinpoint.thrift.dto.TIntStringStringValue) PIntStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringValue) IntStringValue(com.navercorp.pinpoint.common.util.IntStringValue) PIntStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringValue) TIntStringValue(com.navercorp.pinpoint.thrift.dto.TIntStringValue) DataType(com.navercorp.pinpoint.common.util.DataType)

Example 3 with LongIntIntByteByteStringValue

use of com.navercorp.pinpoint.common.util.LongIntIntByteByteStringValue in project pinpoint by naver.

the class AnnotationTranscoder method decodeLongIntIntByteByteStringValue.

private Object decodeLongIntIntByteByteStringValue(byte[] data) {
    final Buffer buffer = new FixedBuffer(data);
    final byte bitField = buffer.readByte();
    final long longValue = buffer.readVLong();
    final int intValue1 = buffer.readVInt();
    int intValue2 = -1;
    if (BitFieldUtils.testBit(bitField, 0)) {
        intValue2 = buffer.readVInt();
    }
    byte byteValue1 = -1;
    if (BitFieldUtils.testBit(bitField, 1)) {
        byteValue1 = buffer.readByte();
    }
    byte byteValue2 = -1;
    if (BitFieldUtils.testBit(bitField, 2)) {
        byteValue2 = buffer.readByte();
    }
    String stringValue = null;
    if (BitFieldUtils.testBit(bitField, 3)) {
        stringValue = BytesUtils.toString(buffer.readPrefixedBytes());
    }
    return new LongIntIntByteByteStringValue(longValue, intValue1, intValue2, byteValue1, byteValue2, stringValue);
}
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) LongIntIntByteByteStringValue(com.navercorp.pinpoint.common.util.LongIntIntByteByteStringValue)

Example 4 with LongIntIntByteByteStringValue

use of com.navercorp.pinpoint.common.util.LongIntIntByteByteStringValue in project pinpoint by naver.

the class AnnotationTranscoder method encodeLongIntIntByteByteStringValue.

private byte[] encodeLongIntIntByteByteStringValue(Object o) {
    final LongIntIntByteByteStringValue value = (LongIntIntByteByteStringValue) o;
    byte bitField = 0;
    bitField = newBitField(value);
    final byte[] stringValue = BytesUtils.toBytes(value.getStringValue());
    // bitField + long + int + int + byte + byte + string
    final int bufferSize = getBufferSize(stringValue, 1 + 8 + 4 + 4 + 1 + 1);
    final Buffer buffer = new AutomaticBuffer(bufferSize);
    buffer.putByte(bitField);
    buffer.putVLong(value.getLongValue());
    buffer.putVInt(value.getIntValue1());
    if (isSetIntValue2(value)) {
        buffer.putVInt(value.getIntValue2());
    }
    if (isSetByteValue1(value)) {
        buffer.putByte(value.getByteValue1());
    }
    if (isSetByteValue2(value)) {
        buffer.putByte(value.getByteValue2());
    }
    if (isSetStringValue(value)) {
        buffer.putPrefixedBytes(stringValue);
    }
    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) LongIntIntByteByteStringValue(com.navercorp.pinpoint.common.util.LongIntIntByteByteStringValue)

Example 5 with LongIntIntByteByteStringValue

use of com.navercorp.pinpoint.common.util.LongIntIntByteByteStringValue in project pinpoint by naver.

the class GrpcAnnotationValueMapperTest method buildPAnnotationValue_LongIntIntByteByteStringValue.

@Test
public void buildPAnnotationValue_LongIntIntByteByteStringValue() {
    LongIntIntByteByteStringValue intStringValue = new LongIntIntByteByteStringValue(1L, 2, 3, (byte) 4, (byte) 5, "6");
    PAnnotationValue container = mapper.buildPAnnotationValue(Annotations.of(1, intStringValue));
    PLongIntIntByteByteStringValue pAnnotation = container.getLongIntIntByteByteStringValue();
    Assert.assertEquals(pAnnotation.getLongValue(), 1);
    Assert.assertEquals(pAnnotation.getIntValue1(), 2);
    Assert.assertEquals(pAnnotation.getIntValue2(), 3);
    Assert.assertEquals(pAnnotation.getByteValue1(), 4);
    Assert.assertEquals(pAnnotation.getByteValue2(), 5);
    Assert.assertEquals(pAnnotation.getStringValue().getValue(), "6");
}
Also used : PAnnotationValue(com.navercorp.pinpoint.grpc.trace.PAnnotationValue) PLongIntIntByteByteStringValue(com.navercorp.pinpoint.grpc.trace.PLongIntIntByteByteStringValue) PLongIntIntByteByteStringValue(com.navercorp.pinpoint.grpc.trace.PLongIntIntByteByteStringValue) LongIntIntByteByteStringValue(com.navercorp.pinpoint.common.util.LongIntIntByteByteStringValue) Test(org.junit.Test)

Aggregations

LongIntIntByteByteStringValue (com.navercorp.pinpoint.common.util.LongIntIntByteByteStringValue)9 PLongIntIntByteByteStringValue (com.navercorp.pinpoint.grpc.trace.PLongIntIntByteByteStringValue)5 IntStringStringValue (com.navercorp.pinpoint.common.util.IntStringStringValue)3 IntStringValue (com.navercorp.pinpoint.common.util.IntStringValue)3 StringStringValue (com.navercorp.pinpoint.common.util.StringStringValue)3 PIntStringStringValue (com.navercorp.pinpoint.grpc.trace.PIntStringStringValue)3 PIntStringValue (com.navercorp.pinpoint.grpc.trace.PIntStringValue)3 PStringStringValue (com.navercorp.pinpoint.grpc.trace.PStringStringValue)3 AutomaticBuffer (com.navercorp.pinpoint.common.buffer.AutomaticBuffer)2 Buffer (com.navercorp.pinpoint.common.buffer.Buffer)2 FixedBuffer (com.navercorp.pinpoint.common.buffer.FixedBuffer)2 DataType (com.navercorp.pinpoint.common.util.DataType)2 IntBooleanIntBooleanValue (com.navercorp.pinpoint.common.util.IntBooleanIntBooleanValue)2 PAnnotationValue (com.navercorp.pinpoint.grpc.trace.PAnnotationValue)2 PIntBooleanIntBooleanValue (com.navercorp.pinpoint.grpc.trace.PIntBooleanIntBooleanValue)2 TIntBooleanIntBooleanValue (com.navercorp.pinpoint.thrift.dto.TIntBooleanIntBooleanValue)2 TIntStringStringValue (com.navercorp.pinpoint.thrift.dto.TIntStringStringValue)2 TIntStringValue (com.navercorp.pinpoint.thrift.dto.TIntStringValue)2 TLongIntIntByteByteStringValue (com.navercorp.pinpoint.thrift.dto.TLongIntIntByteByteStringValue)2 TStringStringValue (com.navercorp.pinpoint.thrift.dto.TStringStringValue)2