Search in sources :

Example 1 with PAnnotationValue

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

the class SpanClientMock method span.

public void span(int count) {
    final int size = 1000;
    final byte[] bytes = new byte[size];
    for (int i = 0; i < size; i++) {
        bytes[i] = (byte) i;
    }
    PAnnotationValue value = PAnnotationValue.newBuilder().setBinaryValue(ByteString.copyFrom(bytes)).build();
    PAnnotation annotation = PAnnotation.newBuilder().setValue(value).build();
    PSpanEvent spanEvent = PSpanEvent.newBuilder().addAnnotation(annotation).build();
    AtomicLong counter = new AtomicLong();
    service.execute(new Runnable() {

        @Override
        public void run() {
            // StreamObserver<PSpanMessage> requestObserver = spanStub.sendSpan(responseObserver);
            try {
                TimeUnit.SECONDS.sleep(3);
            } catch (InterruptedException e) {
            }
            for (int i = 0; i < count; i++) {
                final PSpan span = PSpan.newBuilder().setSpanId(i).addSpanEvent(spanEvent).build();
                final PSpanMessage spanMessage = PSpanMessage.newBuilder().setSpan(span).build();
                spanStream.onNext(spanMessage);
                // requestObserver.onNext(spanMessage);
                try {
                    TimeUnit.MILLISECONDS.sleep(10);
                } catch (InterruptedException e) {
                }
            // System.out.print("S");
            }
            spanStream.onCompleted();
        // requestObserver.onCompleted();
        }
    });
}
Also used : PAnnotationValue(com.navercorp.pinpoint.grpc.trace.PAnnotationValue) AtomicLong(java.util.concurrent.atomic.AtomicLong) PSpanMessage(com.navercorp.pinpoint.grpc.trace.PSpanMessage) PSpan(com.navercorp.pinpoint.grpc.trace.PSpan) PAnnotation(com.navercorp.pinpoint.grpc.trace.PAnnotation) PSpanEvent(com.navercorp.pinpoint.grpc.trace.PSpanEvent)

Example 2 with PAnnotationValue

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

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

the class GrpcAnnotationValueMapperTest method buildPAnnotationValue_IntBooleanIntBooleanValue.

@Test
public void buildPAnnotationValue_IntBooleanIntBooleanValue() {
    IntBooleanIntBooleanValue intStringValue = new IntBooleanIntBooleanValue(1, true, 3, false);
    PAnnotationValue container = mapper.buildPAnnotationValue(Annotations.of(1, intStringValue));
    PIntBooleanIntBooleanValue pAnnotation = container.getIntBooleanIntBooleanValue();
    Assert.assertEquals(pAnnotation.getIntValue1(), 1);
    Assert.assertEquals(pAnnotation.getBoolValue1(), true);
    Assert.assertEquals(pAnnotation.getIntValue2(), 3);
    Assert.assertEquals(pAnnotation.getBoolValue2(), false);
}
Also used : PAnnotationValue(com.navercorp.pinpoint.grpc.trace.PAnnotationValue) IntBooleanIntBooleanValue(com.navercorp.pinpoint.common.util.IntBooleanIntBooleanValue) PIntBooleanIntBooleanValue(com.navercorp.pinpoint.grpc.trace.PIntBooleanIntBooleanValue) PIntBooleanIntBooleanValue(com.navercorp.pinpoint.grpc.trace.PIntBooleanIntBooleanValue) Test(org.junit.Test)

Example 4 with PAnnotationValue

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

the class GrpcAnnotationValueMapperTest method buildPAnnotationValue_Object.

@Test
public void buildPAnnotationValue_Object() {
    PAnnotationValue value = mapper.buildPAnnotationValue(Annotations.of(1, new User("name")));
    assertEquals("name", value.getStringValue());
}
Also used : PAnnotationValue(com.navercorp.pinpoint.grpc.trace.PAnnotationValue) Test(org.junit.Test)

Example 5 with PAnnotationValue

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

the class GrpcAnnotationValueMapperTest method buildPAnnotationValue_IntStringStringValue.

@Test
public void buildPAnnotationValue_IntStringStringValue() {
    IntStringStringValue intStringValue = new IntStringStringValue(1, "2", "3");
    PAnnotationValue container = mapper.buildPAnnotationValue(Annotations.of(1, intStringValue));
    PIntStringStringValue pAnnotation = container.getIntStringStringValue();
    Assert.assertEquals(pAnnotation.getIntValue(), 1);
    Assert.assertEquals(pAnnotation.getStringValue1().getValue(), "2");
    Assert.assertEquals(pAnnotation.getStringValue2().getValue(), "3");
}
Also used : IntStringStringValue(com.navercorp.pinpoint.common.util.IntStringStringValue) PIntStringStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringStringValue) PAnnotationValue(com.navercorp.pinpoint.grpc.trace.PAnnotationValue) PIntStringStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringStringValue) 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