Search in sources :

Example 6 with PAnnotationValue

use of com.navercorp.pinpoint.grpc.trace.PAnnotationValue 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)

Example 7 with PAnnotationValue

use of com.navercorp.pinpoint.grpc.trace.PAnnotationValue in project pinpoint by naver.

the class GrpcAnnotationHandler method getValue.

@Override
public Object getValue(PAnnotation annotation) {
    if (!annotation.hasValue()) {
        return null;
    }
    final PAnnotationValue value = annotation.getValue();
    Descriptors.Descriptor descriptorForType = value.getDescriptorForType();
    int number = value.getFieldCase().getNumber();
    Descriptors.FieldDescriptor fieldByNumber = descriptorForType.findFieldByNumber(number);
    return value.getField(fieldByNumber);
}
Also used : PAnnotationValue(com.navercorp.pinpoint.grpc.trace.PAnnotationValue) Descriptors(com.google.protobuf.Descriptors)

Example 8 with PAnnotationValue

use of com.navercorp.pinpoint.grpc.trace.PAnnotationValue in project pinpoint by naver.

the class GrpcSpanMessageConverter method buildPAnnotation.

@VisibleForTesting
List<PAnnotation> buildPAnnotation(List<Annotation<?>> annotations) {
    final List<PAnnotation> tAnnotationList = new ArrayList<>(annotations.size());
    for (Annotation<?> annotation : annotations) {
        final PAnnotation.Builder builder = getAnnotationBuilder();
        builder.setKey(annotation.getKey());
        final PAnnotationValue pAnnotationValue = grpcAnnotationValueMapper.buildPAnnotationValue(annotation);
        if (pAnnotationValue != null) {
            builder.setValue(pAnnotationValue);
        }
        PAnnotation pAnnotation = builder.build();
        tAnnotationList.add(pAnnotation);
    }
    return tAnnotationList;
}
Also used : PAnnotationValue(com.navercorp.pinpoint.grpc.trace.PAnnotationValue) PAnnotation(com.navercorp.pinpoint.grpc.trace.PAnnotation) ArrayList(java.util.ArrayList) VisibleForTesting(com.navercorp.pinpoint.common.annotations.VisibleForTesting)

Example 9 with PAnnotationValue

use of com.navercorp.pinpoint.grpc.trace.PAnnotationValue in project pinpoint by naver.

the class GrpcAnnotationValueMapperTest method buildPAnnotationValue_null.

@Test
public void buildPAnnotationValue_null() {
    PAnnotationValue value = mapper.buildPAnnotationValue(Annotations.of(1));
    assertNull(value);
}
Also used : PAnnotationValue(com.navercorp.pinpoint.grpc.trace.PAnnotationValue) Test(org.junit.Test)

Example 10 with PAnnotationValue

use of com.navercorp.pinpoint.grpc.trace.PAnnotationValue in project pinpoint by naver.

the class GrpcAnnotationValueMapperTest method buildPAnnotationValue_StringString.

@Test
public void buildPAnnotationValue_StringString() {
    StringStringValue intStringValue = new StringStringValue("1", "2");
    PAnnotationValue container = mapper.buildPAnnotationValue(Annotations.of(1, intStringValue));
    PStringStringValue pAnnotation = container.getStringStringValue();
    Assert.assertEquals(pAnnotation.getStringValue1().getValue(), "1");
    Assert.assertEquals(pAnnotation.getStringValue2().getValue(), "2");
}
Also used : PAnnotationValue(com.navercorp.pinpoint.grpc.trace.PAnnotationValue) 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) PStringStringValue(com.navercorp.pinpoint.grpc.trace.PStringStringValue) Test(org.junit.Test)

Aggregations

PAnnotationValue (com.navercorp.pinpoint.grpc.trace.PAnnotationValue)12 Test (org.junit.Test)8 IntStringStringValue (com.navercorp.pinpoint.common.util.IntStringStringValue)3 PIntStringStringValue (com.navercorp.pinpoint.grpc.trace.PIntStringStringValue)3 IntBooleanIntBooleanValue (com.navercorp.pinpoint.common.util.IntBooleanIntBooleanValue)2 IntStringValue (com.navercorp.pinpoint.common.util.IntStringValue)2 LongIntIntByteByteStringValue (com.navercorp.pinpoint.common.util.LongIntIntByteByteStringValue)2 StringStringValue (com.navercorp.pinpoint.common.util.StringStringValue)2 PAnnotation (com.navercorp.pinpoint.grpc.trace.PAnnotation)2 PIntBooleanIntBooleanValue (com.navercorp.pinpoint.grpc.trace.PIntBooleanIntBooleanValue)2 PIntStringValue (com.navercorp.pinpoint.grpc.trace.PIntStringValue)2 PLongIntIntByteByteStringValue (com.navercorp.pinpoint.grpc.trace.PLongIntIntByteByteStringValue)2 PStringStringValue (com.navercorp.pinpoint.grpc.trace.PStringStringValue)2 Descriptors (com.google.protobuf.Descriptors)1 VisibleForTesting (com.navercorp.pinpoint.common.annotations.VisibleForTesting)1 DataType (com.navercorp.pinpoint.common.util.DataType)1 PSpan (com.navercorp.pinpoint.grpc.trace.PSpan)1 PSpanEvent (com.navercorp.pinpoint.grpc.trace.PSpanEvent)1 PSpanMessage (com.navercorp.pinpoint.grpc.trace.PSpanMessage)1 TIntBooleanIntBooleanValue (com.navercorp.pinpoint.thrift.dto.TIntBooleanIntBooleanValue)1