Search in sources :

Example 1 with IntBooleanIntBooleanValue

use of com.navercorp.pinpoint.common.util.IntBooleanIntBooleanValue 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 2 with IntBooleanIntBooleanValue

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

the class HttpRequestExecutorExecuteMethodInterceptor method after.

@Override
public void after(Object target, Object[] args, Object result, Throwable throwable) {
    if (isDebug) {
        logger.afterInterceptor(target, args);
    }
    final Trace trace = traceContext.currentTraceObject();
    if (trace == null) {
        return;
    }
    try {
        final SpanEventRecorder recorder = trace.currentSpanEventRecorder();
        final HttpRequest httpRequest = getHttpRequest(args);
        final NameIntValuePair<String> host = getHost();
        if (httpRequest != null) {
            ClientRequestWrapper clientRequest = new HttpClient4RequestWrapper(httpRequest, host.getName(), host.getValue());
            this.clientRequestRecorder.record(recorder, clientRequest, throwable);
            this.cookieRecorder.record(recorder, httpRequest, throwable);
        }
        if (statusCode) {
            final Integer statusCodeValue = getStatusCode(result);
            if (statusCodeValue != null) {
                recorder.recordAttribute(AnnotationKey.HTTP_STATUS_CODE, statusCodeValue);
            }
            recordResponseHeader(recorder, result);
        }
        recorder.recordApi(methodDescriptor);
        recorder.recordException(throwable);
        final InterceptorScopeInvocation invocation = interceptorScope.getCurrentInvocation();
        final Object attachment = getAttachment(invocation);
        if (attachment instanceof HttpCallContext) {
            final HttpCallContext callContext = (HttpCallContext) attachment;
            logger.debug("Check call context {}", callContext);
            if (io) {
                final IntBooleanIntBooleanValue value = new IntBooleanIntBooleanValue((int) callContext.getWriteElapsedTime(), callContext.isWriteFail(), (int) callContext.getReadElapsedTime(), callContext.isReadFail());
                recorder.recordAttribute(AnnotationKey.HTTP_IO, value);
            }
            // clear
            invocation.removeAttachment();
        }
    } finally {
        trace.traceBlockEnd();
    }
}
Also used : Trace(com.navercorp.pinpoint.bootstrap.context.Trace) HttpRequest(org.apache.http.HttpRequest) InterceptorScopeInvocation(com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScopeInvocation) HttpCallContext(com.navercorp.pinpoint.plugin.httpclient4.HttpCallContext) ClientRequestWrapper(com.navercorp.pinpoint.bootstrap.plugin.request.ClientRequestWrapper) SpanEventRecorder(com.navercorp.pinpoint.bootstrap.context.SpanEventRecorder) IntBooleanIntBooleanValue(com.navercorp.pinpoint.common.util.IntBooleanIntBooleanValue) HttpClient4RequestWrapper(com.navercorp.pinpoint.plugin.httpclient4.HttpClient4RequestWrapper)

Example 3 with IntBooleanIntBooleanValue

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

the class AnnotationTranscoder method decodeIntBooleanIntBooleanValue.

private Object decodeIntBooleanIntBooleanValue(byte[] data) {
    final Buffer buffer = new FixedBuffer(data);
    final int intValue1 = buffer.readVInt();
    final boolean booleanValue1 = buffer.readBoolean();
    final int intValue2 = buffer.readVInt();
    final boolean booleanValue2 = buffer.readBoolean();
    return new IntBooleanIntBooleanValue(intValue1, booleanValue1, intValue2, booleanValue2);
}
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) IntBooleanIntBooleanValue(com.navercorp.pinpoint.common.util.IntBooleanIntBooleanValue)

Example 4 with IntBooleanIntBooleanValue

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

the class HttpMethodBaseExecuteMethodInterceptor method recordIo.

private void recordIo(SpanEventRecorder recorder, HttpClient3CallContext callContext) {
    if (io) {
        IntBooleanIntBooleanValue value = new IntBooleanIntBooleanValue((int) callContext.getWriteElapsedTime(), callContext.isWriteFail(), (int) callContext.getReadElapsedTime(), callContext.isReadFail());
        recorder.recordAttribute(AnnotationKey.HTTP_IO, value);
    }
}
Also used : IntBooleanIntBooleanValue(com.navercorp.pinpoint.common.util.IntBooleanIntBooleanValue)

Example 5 with IntBooleanIntBooleanValue

use of com.navercorp.pinpoint.common.util.IntBooleanIntBooleanValue 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)

Aggregations

IntBooleanIntBooleanValue (com.navercorp.pinpoint.common.util.IntBooleanIntBooleanValue)9 PIntBooleanIntBooleanValue (com.navercorp.pinpoint.grpc.trace.PIntBooleanIntBooleanValue)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 IntStringStringValue (com.navercorp.pinpoint.common.util.IntStringStringValue)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 PAnnotationValue (com.navercorp.pinpoint.grpc.trace.PAnnotationValue)2 PIntStringStringValue (com.navercorp.pinpoint.grpc.trace.PIntStringStringValue)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 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