Search in sources :

Example 1 with TRouteResult

use of com.navercorp.pinpoint.thrift.dto.command.TRouteResult in project pinpoint by naver.

the class AgentServiceImpl method createActiveThreadCount.

private AgentActiveThreadCount createActiveThreadCount(String agentId, PinpointRouteResponse response) {
    TRouteResult routeResult = response.getRouteResult();
    if (routeResult == TRouteResult.OK) {
        AgentActiveThreadCountFactory factory = new AgentActiveThreadCountFactory();
        factory.setAgentId(agentId);
        return factory.create(response.getResponse(TCmdActiveThreadCountRes.class, null));
    } else {
        AgentActiveThreadCountFactory factory = new AgentActiveThreadCountFactory();
        factory.setAgentId(agentId);
        return factory.createFail(routeResult.name());
    }
}
Also used : AgentActiveThreadCountFactory(com.navercorp.pinpoint.web.vo.AgentActiveThreadCountFactory) TCmdActiveThreadCountRes(com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadCountRes) TRouteResult(com.navercorp.pinpoint.thrift.dto.command.TRouteResult)

Example 2 with TRouteResult

use of com.navercorp.pinpoint.thrift.dto.command.TRouteResult in project pinpoint by naver.

the class ClusterPointRouter method handleStreamRouteCreate.

private StreamCode handleStreamRouteCreate(TCommandTransfer request, StreamCreatePacket packet, ServerStreamChannelContext streamChannelContext) {
    byte[] payload = ((TCommandTransfer) request).getPayload();
    TBase<?, ?> command = deserialize(payload);
    if (command == null) {
        return StreamCode.TYPE_UNKNOWN;
    }
    TCommandTransferResponse response = streamRouteHandler.onRoute(new StreamEvent((TCommandTransfer) request, streamChannelContext, command));
    TRouteResult routeResult = response.getRouteResult();
    if (routeResult != TRouteResult.OK) {
        logger.warn("handleStreamRouteCreate failed. command:{}, routeResult:{}", command, routeResult);
        return convertToStreamCode(routeResult);
    }
    return StreamCode.OK;
}
Also used : TCommandTransfer(com.navercorp.pinpoint.thrift.dto.command.TCommandTransfer) TCommandTransferResponse(com.navercorp.pinpoint.thrift.dto.command.TCommandTransferResponse) StreamEvent(com.navercorp.pinpoint.collector.cluster.route.StreamEvent) TRouteResult(com.navercorp.pinpoint.thrift.dto.command.TRouteResult)

Example 3 with TRouteResult

use of com.navercorp.pinpoint.thrift.dto.command.TRouteResult in project pinpoint by naver.

the class DefaultPinpointRouteResponse method parse.

public void parse(DeserializerFactory<HeaderTBaseDeserializer> commandDeserializerFactory) {
    if (!isParsed) {
        if (payload == null || payload.length == 0) {
            routeResult = TRouteResult.EMPTY_RESPONSE;
            return;
        }
        TBase object = deserialize(commandDeserializerFactory, payload, null);
        if (object == null) {
            routeResult = TRouteResult.NOT_SUPPORTED_RESPONSE;
        } else if (object instanceof TCommandTransferResponse) {
            TCommandTransferResponse commandResponse = (TCommandTransferResponse) object;
            TRouteResult routeResult = commandResponse.getRouteResult();
            if (routeResult == null) {
                this.routeResult = TRouteResult.UNKNOWN;
            } else {
                this.routeResult = routeResult;
            }
            response = deserialize(commandDeserializerFactory, commandResponse.getPayload(), null);
        } else {
            routeResult = TRouteResult.UNKNOWN;
            response = object;
        }
        isParsed = true;
    }
}
Also used : TCommandTransferResponse(com.navercorp.pinpoint.thrift.dto.command.TCommandTransferResponse) TRouteResult(com.navercorp.pinpoint.thrift.dto.command.TRouteResult) TBase(org.apache.thrift.TBase)

Aggregations

TRouteResult (com.navercorp.pinpoint.thrift.dto.command.TRouteResult)3 TCommandTransferResponse (com.navercorp.pinpoint.thrift.dto.command.TCommandTransferResponse)2 StreamEvent (com.navercorp.pinpoint.collector.cluster.route.StreamEvent)1 TCmdActiveThreadCountRes (com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadCountRes)1 TCommandTransfer (com.navercorp.pinpoint.thrift.dto.command.TCommandTransfer)1 AgentActiveThreadCountFactory (com.navercorp.pinpoint.web.vo.AgentActiveThreadCountFactory)1 TBase (org.apache.thrift.TBase)1