Search in sources :

Example 1 with PSqlMetaData

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

the class AgentClientMock method sqlMetaData.

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

Example 2 with PSqlMetaData

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

the class MetadataClientMock method sqlMetaData.

public void sqlMetaData(final int count) {
    for (int i = 0; i < count; i++) {
        PSqlMetaData request = PSqlMetaData.newBuilder().build();
        request(request, MAX_TOTAL_ATTEMPTS);
    }
}
Also used : PSqlMetaData(com.navercorp.pinpoint.grpc.trace.PSqlMetaData)

Example 3 with PSqlMetaData

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

the class MetadataClientMock method request.

private void request(GeneratedMessageV3 message, int retryCount) {
    if (retryCount <= 0) {
        logger.warn("Drop message {}", debugLog(message));
        return;
    }
    if (message instanceof PSqlMetaData) {
        PSqlMetaData sqlMetaData = (PSqlMetaData) message;
        StreamObserver<PResult> responseObserver = newResponseObserver(message, retryCount);
        this.metadataStub.requestSqlMetaData(sqlMetaData, responseObserver);
    } else if (message instanceof PApiMetaData) {
        final PApiMetaData apiMetaData = (PApiMetaData) message;
        StreamObserver<PResult> responseObserver = newResponseObserver(message, retryCount);
        this.metadataStub.requestApiMetaData(apiMetaData, responseObserver);
    } else if (message instanceof PStringMetaData) {
        final PStringMetaData stringMetaData = (PStringMetaData) message;
        StreamObserver<PResult> responseObserver = newResponseObserver(message, retryCount);
        this.metadataStub.requestStringMetaData(stringMetaData, responseObserver);
    } else {
        logger.warn("Unsupported message {}", debugLog(message));
    }
    int requestCount = requestCounter.getAndIncrement();
    logger.info("Request {} {}", requestCount, message);
    Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS);
}
Also used : StreamObserver(io.grpc.stub.StreamObserver) RetryResponseStreamObserver(com.navercorp.pinpoint.profiler.sender.grpc.RetryResponseStreamObserver) PSqlMetaData(com.navercorp.pinpoint.grpc.trace.PSqlMetaData) PStringMetaData(com.navercorp.pinpoint.grpc.trace.PStringMetaData) PResult(com.navercorp.pinpoint.grpc.trace.PResult) PApiMetaData(com.navercorp.pinpoint.grpc.trace.PApiMetaData)

Example 4 with PSqlMetaData

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

the class MetadataGrpcDataSender method request0.

// Request
private void request0(final GeneratedMessageV3 message, final int remainingRetryCount) {
    if (message instanceof PSqlMetaData) {
        final PSqlMetaData sqlMetaData = (PSqlMetaData) message;
        final StreamObserver<PResult> responseObserver = newResponseStream(message, remainingRetryCount);
        this.metadataStub.requestSqlMetaData(sqlMetaData, responseObserver);
    } else if (message instanceof PApiMetaData) {
        final PApiMetaData apiMetaData = (PApiMetaData) message;
        final StreamObserver<PResult> responseObserver = newResponseStream(message, remainingRetryCount);
        this.metadataStub.requestApiMetaData(apiMetaData, responseObserver);
    } else if (message instanceof PStringMetaData) {
        final PStringMetaData stringMetaData = (PStringMetaData) message;
        final StreamObserver<PResult> responseObserver = newResponseStream(message, remainingRetryCount);
        this.metadataStub.requestStringMetaData(stringMetaData, responseObserver);
    } else {
        logger.warn("Unsupported message {}", MessageFormatUtils.debugLog(message));
    }
}
Also used : StreamObserver(io.grpc.stub.StreamObserver) PSqlMetaData(com.navercorp.pinpoint.grpc.trace.PSqlMetaData) PStringMetaData(com.navercorp.pinpoint.grpc.trace.PStringMetaData) PResult(com.navercorp.pinpoint.grpc.trace.PResult) PApiMetaData(com.navercorp.pinpoint.grpc.trace.PApiMetaData)

Example 5 with PSqlMetaData

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

Aggregations

PSqlMetaData (com.navercorp.pinpoint.grpc.trace.PSqlMetaData)5 PResult (com.navercorp.pinpoint.grpc.trace.PResult)4 PApiMetaData (com.navercorp.pinpoint.grpc.trace.PApiMetaData)2 PStringMetaData (com.navercorp.pinpoint.grpc.trace.PStringMetaData)2 StreamObserver (io.grpc.stub.StreamObserver)2 GeneratedMessageV3 (com.google.protobuf.GeneratedMessageV3)1 RetryResponseStreamObserver (com.navercorp.pinpoint.profiler.sender.grpc.RetryResponseStreamObserver)1