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);
}
}
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;
}
Aggregations