Search in sources :

Example 1 with PAgentInfo

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

the class AgentClientMock method info.

public void info(final int count) {
    for (int i = 0; i < count; i++) {
        PAgentInfo request = PAgentInfo.newBuilder().build();
        QueueingStreamObserver<PResult> responseObserver = getResponseObserver();
        agentStub.requestAgentInfo(request, responseObserver);
        PResult value = responseObserver.getValue();
        logger.info("Result {}", value);
    }
}
Also used : PResult(com.navercorp.pinpoint.grpc.trace.PResult) PAgentInfo(com.navercorp.pinpoint.grpc.trace.PAgentInfo)

Example 2 with PAgentInfo

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

the class GrpcAgentInfoMessageConverter method convertAgentInfo.

public PAgentInfo convertAgentInfo(final AgentInfo agentInfo) {
    final AgentInformation agentInformation = agentInfo.getAgentInformation();
    final PAgentInfo.Builder builder = PAgentInfo.newBuilder();
    builder.setIp(agentInformation.getHostIp());
    builder.setHostname(agentInformation.getMachineName());
    builder.setPorts("");
    builder.setContainer(agentInformation.isContainer());
    builder.setPid(agentInformation.getPid());
    builder.setServiceType(agentInformation.getServerType().getCode());
    builder.setVmVersion(agentInformation.getJvmVersion());
    builder.setAgentVersion(Version.VERSION);
    final ServerMetaData serverMetaData = agentInfo.getServerMetaData();
    if (serverMetaData != null) {
        final PServerMetaData tServerMetaData = convertServerMetaData(agentInfo.getServerMetaData());
        builder.setServerMetaData(tServerMetaData);
    }
    final JvmInformation jvmInformation = agentInfo.getJvmInfo();
    if (jvmInformation != null) {
        final PJvmInfo tJvmInfo = convertJvmInfo(agentInfo.getJvmInfo());
        builder.setJvmInfo(tJvmInfo);
    }
    return builder.build();
}
Also used : PJvmInfo(com.navercorp.pinpoint.grpc.trace.PJvmInfo) AgentInformation(com.navercorp.pinpoint.profiler.AgentInformation) ServerMetaData(com.navercorp.pinpoint.bootstrap.context.ServerMetaData) PServerMetaData(com.navercorp.pinpoint.grpc.trace.PServerMetaData) PAgentInfo(com.navercorp.pinpoint.grpc.trace.PAgentInfo) PServerMetaData(com.navercorp.pinpoint.grpc.trace.PServerMetaData) JvmInformation(com.navercorp.pinpoint.profiler.JvmInformation)

Example 3 with PAgentInfo

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

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

the class AgentGrpcDataSender method request.

@Override
public boolean request(T data, final FutureListener<ResponseMessage> listener) {
    final GeneratedMessageV3 message = this.messageConverter.toMessage(data);
    if (!(message instanceof PAgentInfo)) {
        throw new IllegalArgumentException("unsupported message " + data);
    }
    final PAgentInfo pAgentInfo = (PAgentInfo) message;
    this.agentInfoStub.requestAgentInfo(pAgentInfo, new FutureListenerStreamObserver(listener));
    return true;
}
Also used : GeneratedMessageV3(com.google.protobuf.GeneratedMessageV3) PAgentInfo(com.navercorp.pinpoint.grpc.trace.PAgentInfo)

Example 5 with PAgentInfo

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

PAgentInfo (com.navercorp.pinpoint.grpc.trace.PAgentInfo)5 PResult (com.navercorp.pinpoint.grpc.trace.PResult)3 GeneratedMessageV3 (com.google.protobuf.GeneratedMessageV3)2 ServerMetaData (com.navercorp.pinpoint.bootstrap.context.ServerMetaData)1 PJvmInfo (com.navercorp.pinpoint.grpc.trace.PJvmInfo)1 PServerMetaData (com.navercorp.pinpoint.grpc.trace.PServerMetaData)1 AgentInformation (com.navercorp.pinpoint.profiler.AgentInformation)1 JvmInformation (com.navercorp.pinpoint.profiler.JvmInformation)1 Channel (io.grpc.Channel)1 Test (org.junit.Test)1