Search in sources :

Example 6 with PResult

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

the class AgentClientMock method stringMetaData.

public void stringMetaData(final int count) {
    for (int i = 0; i < count; i++) {
        PStringMetaData request = PStringMetaData.newBuilder().build();
        PResult result = metadataStub.requestStringMetaData(request);
    }
}
Also used : PStringMetaData(com.navercorp.pinpoint.grpc.trace.PStringMetaData) PResult(com.navercorp.pinpoint.grpc.trace.PResult)

Example 7 with PResult

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

the class UnaryCallDeadlineInterceptorTest method withDeadlineTest.

@Test
public void withDeadlineTest() {
    Channel channel = new TestChannel();
    UnaryCallDeadlineInterceptor unaryCallDeadlineInterceptor = new UnaryCallDeadlineInterceptor(5000);
    ClientCall<PAgentInfo, PResult> pAgentInfoPResultClientCall = unaryCallDeadlineInterceptor.interceptCall(createMethodDescritor(MethodDescriptor.MethodType.UNARY), CallOptions.DEFAULT.withAuthority("test"), channel);
    Assert.assertNotNull(((TestChannel) channel).callOptions.getDeadline());
}
Also used : Channel(io.grpc.Channel) PResult(com.navercorp.pinpoint.grpc.trace.PResult) PAgentInfo(com.navercorp.pinpoint.grpc.trace.PAgentInfo) Test(org.junit.Test)

Example 8 with PResult

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

the class GrpcMessageToResultConverter method toMessage.

@Override
public ResultResponse toMessage(Object object) {
    if (object instanceof ResponseMessage) {
        final ResponseMessage responseMessage = (ResponseMessage) object;
        final byte[] byteMessage = responseMessage.getMessage();
        try {
            final PResult pResult = PResult.parseFrom(byteMessage);
            return new ResultResponse() {

                @Override
                public boolean isSuccess() {
                    return pResult.getSuccess();
                }

                @Override
                public String getMessage() {
                    return pResult.getMessage();
                }
            };
        } catch (InvalidProtocolBufferException e) {
            throw new IllegalArgumentException("invalid message data. response message=" + responseMessage, e);
        }
    }
    return null;
}
Also used : ResultResponse(com.navercorp.pinpoint.profiler.sender.ResultResponse) PResult(com.navercorp.pinpoint.grpc.trace.PResult) InvalidProtocolBufferException(com.google.protobuf.InvalidProtocolBufferException) ResponseMessage(com.navercorp.pinpoint.rpc.ResponseMessage)

Example 9 with PResult

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

the class GrpcSqlMetaDataHandler method handleRequest.

@Override
public void handleRequest(ServerRequest<GeneratedMessageV3> serverRequest, ServerResponse<GeneratedMessageV3> serverResponse) {
    final GeneratedMessageV3 data = serverRequest.getData();
    if (data instanceof PSqlMetaData) {
        PResult result = handleSqlMetaData((PSqlMetaData) data);
        serverResponse.write(result);
    } else {
        logger.warn("Invalid request type. serverRequest={}", serverRequest);
        throw Status.INTERNAL.withDescription("Bad Request(invalid request type)").asRuntimeException();
    }
}
Also used : PSqlMetaData(com.navercorp.pinpoint.grpc.trace.PSqlMetaData) PResult(com.navercorp.pinpoint.grpc.trace.PResult) GeneratedMessageV3(com.google.protobuf.GeneratedMessageV3)

Example 10 with PResult

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

the class GrpcAgentInfoHandler method handleRequest.

@Override
public void handleRequest(ServerRequest<GeneratedMessageV3> serverRequest, ServerResponse<GeneratedMessageV3> serverResponse) {
    final GeneratedMessageV3 data = serverRequest.getData();
    if (data instanceof PAgentInfo) {
        final PResult result = handleAgentInfo((PAgentInfo) data);
        serverResponse.write(result);
    } else {
        logger.warn("Invalid request type. serverRequest={}", serverRequest);
        throw Status.INTERNAL.withDescription("Bad Request(invalid request type)").asRuntimeException();
    }
}
Also used : PResult(com.navercorp.pinpoint.grpc.trace.PResult) GeneratedMessageV3(com.google.protobuf.GeneratedMessageV3) PAgentInfo(com.navercorp.pinpoint.grpc.trace.PAgentInfo)

Aggregations

PResult (com.navercorp.pinpoint.grpc.trace.PResult)11 PSqlMetaData (com.navercorp.pinpoint.grpc.trace.PSqlMetaData)4 PStringMetaData (com.navercorp.pinpoint.grpc.trace.PStringMetaData)4 GeneratedMessageV3 (com.google.protobuf.GeneratedMessageV3)3 PAgentInfo (com.navercorp.pinpoint.grpc.trace.PAgentInfo)3 PApiMetaData (com.navercorp.pinpoint.grpc.trace.PApiMetaData)3 StreamObserver (io.grpc.stub.StreamObserver)2 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)1 ResultResponse (com.navercorp.pinpoint.profiler.sender.ResultResponse)1 RetryResponseStreamObserver (com.navercorp.pinpoint.profiler.sender.grpc.RetryResponseStreamObserver)1 ResponseMessage (com.navercorp.pinpoint.rpc.ResponseMessage)1 Channel (io.grpc.Channel)1 Test (org.junit.Test)1