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");
}
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);
}
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;
}
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);
}
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");
}
Aggregations