Search in sources :

Example 11 with AgentEventType

use of com.navercorp.pinpoint.common.server.util.AgentEventType in project pinpoint by naver.

the class AgentLifeCycleChangeEventHandler method eventPerformed.

@Override
public void eventPerformed(PinpointServer pinpointServer, SocketStateCode stateCode) throws Exception {
    ManagedAgentLifeCycle managedAgentLifeCycle = ManagedAgentLifeCycle.getManagedAgentLifeCycleByStateCode(stateCode);
    if (managedAgentLifeCycle == STATE_NOT_MANAGED) {
        return;
    } else {
        logger.info("{} eventPerformed(). pinpointServer:{}, code:{}", this.getClass().getSimpleName(), pinpointServer, stateCode);
        long eventTimestamp = System.currentTimeMillis();
        AgentLifeCycleState agentLifeCycleState = managedAgentLifeCycle.getMappedState();
        this.agentLifeCycleHandler.handleLifeCycleEvent(pinpointServer, eventTimestamp, agentLifeCycleState, managedAgentLifeCycle.getEventCounter());
        AgentEventType agentEventType = managedAgentLifeCycle.getMappedEvent();
        this.agentEventHandler.handleEvent(pinpointServer, eventTimestamp, agentEventType);
    }
}
Also used : AgentEventType(com.navercorp.pinpoint.common.server.util.AgentEventType) ManagedAgentLifeCycle(com.navercorp.pinpoint.collector.util.ManagedAgentLifeCycle) AgentLifeCycleState(com.navercorp.pinpoint.common.server.util.AgentLifeCycleState)

Example 12 with AgentEventType

use of com.navercorp.pinpoint.common.server.util.AgentEventType in project pinpoint by naver.

the class AgentEventMapper method mapRow.

@Override
public List<AgentEventBo> mapRow(Result result, int rowNum) throws Exception {
    if (result.isEmpty()) {
        return Collections.emptyList();
    }
    List<AgentEventBo> agentEvents = new ArrayList<>();
    for (Cell cell : result.rawCells()) {
        byte[] qualifier = CellUtil.cloneQualifier(cell);
        final AgentEventType eventType = AgentEventType.getTypeByCode(BytesUtils.bytesToInt(qualifier, 0));
        if (eventType == null) {
            continue;
        }
        byte[] value = CellUtil.cloneValue(cell);
        final Buffer buffer = new FixedBuffer(value);
        final int version = buffer.readInt();
        switch(version) {
            case 0:
                final String agentId = buffer.readPrefixedString();
                final long startTimestamp = buffer.readLong();
                final long eventTimestamp = buffer.readLong();
                final byte[] eventMessage = buffer.readPrefixedBytes();
                final AgentEventBo agentEvent = new AgentEventBo(version, agentId, startTimestamp, eventTimestamp, eventType);
                agentEvent.setEventBody(eventMessage);
                agentEvents.add(agentEvent);
                break;
            default:
                break;
        }
    }
    return agentEvents;
}
Also used : FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer) Buffer(com.navercorp.pinpoint.common.buffer.Buffer) AgentEventType(com.navercorp.pinpoint.common.server.util.AgentEventType) FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer) AgentEventBo(com.navercorp.pinpoint.common.server.bo.AgentEventBo) ArrayList(java.util.ArrayList) Cell(org.apache.hadoop.hbase.Cell)

Aggregations

AgentEventType (com.navercorp.pinpoint.common.server.util.AgentEventType)12 AgentEventBo (com.navercorp.pinpoint.common.server.bo.AgentEventBo)7 Test (org.junit.Test)4 AgentEvent (com.navercorp.pinpoint.web.vo.AgentEvent)2 ResponseEvent (com.navercorp.pinpoint.collector.cluster.route.ResponseEvent)1 ManagedAgentLifeCycle (com.navercorp.pinpoint.collector.util.ManagedAgentLifeCycle)1 Buffer (com.navercorp.pinpoint.common.buffer.Buffer)1 FixedBuffer (com.navercorp.pinpoint.common.buffer.FixedBuffer)1 AgentLifeCycleState (com.navercorp.pinpoint.common.server.util.AgentLifeCycleState)1 TCommandThreadDumpResponse (com.navercorp.pinpoint.thrift.dto.command.TCommandThreadDumpResponse)1 TCommandTransfer (com.navercorp.pinpoint.thrift.dto.command.TCommandTransfer)1 TCommandTransferResponse (com.navercorp.pinpoint.thrift.dto.command.TCommandTransferResponse)1 HeaderTBaseDeserializer (com.navercorp.pinpoint.thrift.io.HeaderTBaseDeserializer)1 AgentEventFilter (com.navercorp.pinpoint.web.filter.agent.AgentEventFilter)1 DurationalAgentEvent (com.navercorp.pinpoint.web.vo.DurationalAgentEvent)1 Range (com.navercorp.pinpoint.web.vo.Range)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Cell (org.apache.hadoop.hbase.Cell)1 Scan (org.apache.hadoop.hbase.client.Scan)1