Search in sources :

Example 11 with PinpointGrpcServer

use of com.navercorp.pinpoint.collector.receiver.grpc.PinpointGrpcServer in project pinpoint by naver.

the class GrpcCommandService method commandStreamActiveThreadCount.

@Override
public StreamObserver<PCmdActiveThreadCountRes> commandStreamActiveThreadCount(StreamObserver<Empty> streamConnectionManagerObserver) {
    final Long transportId = getTransportId();
    PinpointGrpcServer pinpointGrpcServer = grpcServerRepository.get(transportId);
    if (pinpointGrpcServer == null) {
        logger.info("{} => local. Can't find PinpointGrpcServer(transportId={})", getAgentInfo().getAgentKey(), transportId);
        streamConnectionManagerObserver.onError(new StatusException(Status.NOT_FOUND));
        return DisabledStreamObserver.instance();
    }
    try {
        return activeThreadCountService.handle(pinpointGrpcServer, streamConnectionManagerObserver);
    } catch (IllegalArgumentException e) {
        logger.warn("Failed to handle activeThreadCountService. agentKey={}, transportId={}", getAgentInfo().getAgentKey(), transportId, e);
        streamConnectionManagerObserver.onError(Status.INTERNAL.withDescription("Internal Server Error").asException());
        return DisabledStreamObserver.instance();
    }
}
Also used : StatusException(io.grpc.StatusException) PinpointGrpcServer(com.navercorp.pinpoint.collector.receiver.grpc.PinpointGrpcServer)

Aggregations

PinpointGrpcServer (com.navercorp.pinpoint.collector.receiver.grpc.PinpointGrpcServer)11 StatusException (io.grpc.StatusException)6 AgentInfo (com.navercorp.pinpoint.collector.cluster.AgentInfo)2 GrpcAgentConnection (com.navercorp.pinpoint.collector.cluster.GrpcAgentConnection)2 PCmdMessage (com.navercorp.pinpoint.grpc.trace.PCmdMessage)2 PCmdRequest (com.navercorp.pinpoint.grpc.trace.PCmdRequest)2 PCmdResponse (com.navercorp.pinpoint.grpc.trace.PCmdResponse)2 ServerCallStreamObserver (io.grpc.stub.ServerCallStreamObserver)2 StreamObserver (io.grpc.stub.StreamObserver)2 Test (org.junit.Test)2 ResponseMessage (com.navercorp.pinpoint.rpc.ResponseMessage)1 PinpointServer (com.navercorp.pinpoint.rpc.server.PinpointServer)1 TResult (com.navercorp.pinpoint.thrift.dto.TResult)1 TCommandEcho (com.navercorp.pinpoint.thrift.dto.command.TCommandEcho)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 Set (java.util.Set)1