Search in sources :

Example 11 with IntStringValue

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

the class GrpcAnnotationValueMapper method newIntStringValue.

public PIntStringValue newIntStringValue(IntStringValue v) {
    final PIntStringValue.Builder builder = this.intStringBuilder;
    builder.setIntValue(v.getIntValue());
    if (v.getStringValue() != null) {
        StringValue stringValue = newStringValue(v.getStringValue());
        builder.setStringValue(stringValue);
    }
    PIntStringValue value = builder.build();
    builder.clear();
    return value;
}
Also used : PIntStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringValue) 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 12 with IntStringValue

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

the class DataTypeAnnotation method apply.

@Override
public TAnnotationValue apply(AnnotationValueThriftMapper context) {
    final DataType dataType = this.value;
    if (dataType instanceof IntStringValue) {
        final IntStringValue v = (IntStringValue) dataType;
        final TIntStringValue tIntStringValue = new TIntStringValue(v.getIntValue());
        if (v.getStringValue() != null) {
            tIntStringValue.setStringValue(v.getStringValue());
        }
        return TAnnotationValue.intStringValue(tIntStringValue);
    } else if (dataType instanceof StringStringValue) {
        final StringStringValue v = (StringStringValue) dataType;
        final TStringStringValue tStringStringValue = new TStringStringValue(v.getStringValue1());
        if (v.getStringValue2() != null) {
            tStringStringValue.setStringValue2(v.getStringValue2());
        }
        return TAnnotationValue.stringStringValue(tStringStringValue);
    } else if (dataType instanceof IntStringStringValue) {
        final IntStringStringValue v = (IntStringStringValue) dataType;
        final TIntStringStringValue tIntStringStringValue = new TIntStringStringValue(v.getIntValue());
        if (v.getStringValue1() != null) {
            tIntStringStringValue.setStringValue1(v.getStringValue1());
        }
        if (v.getStringValue2() != null) {
            tIntStringStringValue.setStringValue2(v.getStringValue2());
        }
        return TAnnotationValue.intStringStringValue(tIntStringStringValue);
    } else if (dataType instanceof LongIntIntByteByteStringValue) {
        final LongIntIntByteByteStringValue v = (LongIntIntByteByteStringValue) dataType;
        final TLongIntIntByteByteStringValue tvalue = new TLongIntIntByteByteStringValue(v.getLongValue(), v.getIntValue1());
        if (v.getIntValue2() != -1) {
            tvalue.setIntValue2(v.getIntValue2());
        }
        if (v.getByteValue1() != -1) {
            tvalue.setByteValue1(v.getByteValue1());
        }
        if (v.getByteValue2() != -1) {
            tvalue.setByteValue2(v.getByteValue2());
        }
        if (v.getStringValue() != null) {
            tvalue.setStringValue(v.getStringValue());
        }
        return TAnnotationValue.longIntIntByteByteStringValue(tvalue);
    } else if (dataType instanceof IntBooleanIntBooleanValue) {
        final IntBooleanIntBooleanValue v = (IntBooleanIntBooleanValue) dataType;
        final TIntBooleanIntBooleanValue tvalue = new TIntBooleanIntBooleanValue(v.getIntValue1(), v.isBooleanValue1(), v.getIntValue2(), v.isBooleanValue2());
        return TAnnotationValue.intBooleanIntBooleanValue(tvalue);
    }
    throw new UnsupportedOperationException("unsupported type:" + dataType);
}
Also used : TIntStringValue(com.navercorp.pinpoint.thrift.dto.TIntStringValue) IntStringStringValue(com.navercorp.pinpoint.common.util.IntStringStringValue) PIntStringStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringStringValue) TIntStringStringValue(com.navercorp.pinpoint.thrift.dto.TIntStringStringValue) TLongIntIntByteByteStringValue(com.navercorp.pinpoint.thrift.dto.TLongIntIntByteByteStringValue) TStringStringValue(com.navercorp.pinpoint.thrift.dto.TStringStringValue) TIntBooleanIntBooleanValue(com.navercorp.pinpoint.thrift.dto.TIntBooleanIntBooleanValue) 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) TIntStringStringValue(com.navercorp.pinpoint.thrift.dto.TIntStringStringValue) IntStringValue(com.navercorp.pinpoint.common.util.IntStringValue) PIntStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringValue) TIntStringValue(com.navercorp.pinpoint.thrift.dto.TIntStringValue) IntBooleanIntBooleanValue(com.navercorp.pinpoint.common.util.IntBooleanIntBooleanValue) PIntBooleanIntBooleanValue(com.navercorp.pinpoint.grpc.trace.PIntBooleanIntBooleanValue) TIntBooleanIntBooleanValue(com.navercorp.pinpoint.thrift.dto.TIntBooleanIntBooleanValue) DataType(com.navercorp.pinpoint.common.util.DataType) TLongIntIntByteByteStringValue(com.navercorp.pinpoint.thrift.dto.TLongIntIntByteByteStringValue) PLongIntIntByteByteStringValue(com.navercorp.pinpoint.grpc.trace.PLongIntIntByteByteStringValue) LongIntIntByteByteStringValue(com.navercorp.pinpoint.common.util.LongIntIntByteByteStringValue)

Example 13 with IntStringValue

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

the class AnnotationTranscoder method decodeIntStringValue.

private Object decodeIntStringValue(byte[] data) {
    final Buffer buffer = new FixedBuffer(data);
    final int intValue = buffer.readSVInt();
    final String stringValue = BytesUtils.toString(buffer.readPrefixedBytes());
    return new IntStringValue(intValue, 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) IntStringValue(com.navercorp.pinpoint.common.util.IntStringValue)

Example 14 with IntStringValue

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

the class AnnotationTranscoder method encodeIntStringValue.

private byte[] encodeIntStringValue(Object value) {
    final IntStringValue tIntStringValue = (IntStringValue) 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 : FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer) Buffer(com.navercorp.pinpoint.common.buffer.Buffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) IntStringValue(com.navercorp.pinpoint.common.util.IntStringValue) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer)

Example 15 with IntStringValue

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

the class GrpcAnnotationValueMapperTest method buildPAnnotationValue_IntString.

@Test
public void buildPAnnotationValue_IntString() {
    IntStringValue intStringValue = new IntStringValue(1, "2");
    PAnnotationValue container = mapper.buildPAnnotationValue(Annotations.of(1, intStringValue));
    PIntStringValue pAnnotation = container.getIntStringValue();
    Assert.assertEquals(pAnnotation.getIntValue(), 1);
    Assert.assertEquals(pAnnotation.getStringValue().getValue(), "2");
}
Also used : PAnnotationValue(com.navercorp.pinpoint.grpc.trace.PAnnotationValue) PIntStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringValue) IntStringValue(com.navercorp.pinpoint.common.util.IntStringValue) PIntStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringValue) Test(org.junit.Test)

Aggregations

IntStringValue (com.navercorp.pinpoint.common.util.IntStringValue)16 PIntStringValue (com.navercorp.pinpoint.grpc.trace.PIntStringValue)8 Annotation (com.navercorp.pinpoint.profiler.context.Annotation)5 VisibleForTesting (com.navercorp.pinpoint.common.annotations.VisibleForTesting)4 TIntStringValue (com.navercorp.pinpoint.thrift.dto.TIntStringValue)4 IntStringStringValue (com.navercorp.pinpoint.common.util.IntStringStringValue)3 LongIntIntByteByteStringValue (com.navercorp.pinpoint.common.util.LongIntIntByteByteStringValue)3 StringStringValue (com.navercorp.pinpoint.common.util.StringStringValue)3 PIntStringStringValue (com.navercorp.pinpoint.grpc.trace.PIntStringStringValue)3 PLongIntIntByteByteStringValue (com.navercorp.pinpoint.grpc.trace.PLongIntIntByteByteStringValue)3 PStringStringValue (com.navercorp.pinpoint.grpc.trace.PStringStringValue)3 SpanEvent (com.navercorp.pinpoint.profiler.context.SpanEvent)3 Shared (com.navercorp.pinpoint.profiler.context.id.Shared)3 TraceRoot (com.navercorp.pinpoint.profiler.context.id.TraceRoot)3 TSpanEvent (com.navercorp.pinpoint.thrift.dto.TSpanEvent)3 StringValue (com.google.protobuf.StringValue)2 TraceId (com.navercorp.pinpoint.bootstrap.context.TraceId)2 AutomaticBuffer (com.navercorp.pinpoint.common.buffer.AutomaticBuffer)2 Buffer (com.navercorp.pinpoint.common.buffer.Buffer)2 FixedBuffer (com.navercorp.pinpoint.common.buffer.FixedBuffer)2