use of com.navercorp.pinpoint.common.server.bo.event.AgentEventBo in project pinpoint by naver.
the class AgentEventAsyncTaskService method newAgentEventBo.
private AgentEventBo newAgentEventBo(String agentId, long startTimestamp, long eventTimestamp, AgentEventType eventType) {
final AgentEventBo agentEventBo = new AgentEventBo(agentId, startTimestamp, eventTimestamp, eventType);
agentEventBo.setEventBody(new byte[0]);
return agentEventBo;
}
use of com.navercorp.pinpoint.common.server.bo.event.AgentEventBo in project pinpoint by naver.
the class AgentEventMarkerSerializerTest method makeData.
private AgentEventMarker makeData() {
AgentEventMarker marker = new AgentEventMarker();
for (int i = 0; i < 3; i++) {
marker.addAgentEvent(new AgentEvent(new AgentEventBo("agent", 1000L, 1001L, AgentEventType.AGENT_CONNECTED)));
marker.addAgentEvent(new AgentEvent(new AgentEventBo("agent", 1000L, 1001L, AgentEventType.AGENT_PING)));
marker.addAgentEvent(new AgentEvent(new AgentEventBo("agent", 1000L, 1001L, AgentEventType.AGENT_SHUTDOWN)));
marker.addAgentEvent(new AgentEvent(new AgentEventBo("agent", 1000L, 1001L, AgentEventType.AGENT_UNEXPECTED_SHUTDOWN)));
marker.addAgentEvent(new AgentEvent(new AgentEventBo("agent", 1000L, 1001L, AgentEventType.AGENT_CLOSED_BY_SERVER)));
marker.addAgentEvent(new AgentEvent(new AgentEventBo("agent", 1000L, 1001L, AgentEventType.AGENT_UNEXPECTED_CLOSE_BY_SERVER)));
marker.addAgentEvent(new AgentEvent(new AgentEventBo("agent", 1000L, 1001L, AgentEventType.AGENT_DEADLOCK_DETECTED)));
marker.addAgentEvent(new AgentEvent(new AgentEventBo("agent", 1000L, 1001L, AgentEventType.USER_THREAD_DUMP)));
marker.addAgentEvent(new AgentEvent(new AgentEventBo("agent", 1000L, 1001L, AgentEventType.OTHER)));
}
return marker;
}
use of com.navercorp.pinpoint.common.server.bo.event.AgentEventBo in project pinpoint by naver.
the class AgentEventAsyncTaskServiceTest method handler_should_handle_events_with_empty_message_body.
@Test
public void handler_should_handle_events_with_empty_message_body() {
// given
final AgentEventType expectedEventType = AgentEventType.AGENT_CONNECTED;
ArgumentCaptor<AgentEventBo> argCaptor = ArgumentCaptor.forClass(AgentEventBo.class);
// when
ChannelProperties channelProperties = channelPropertiesFactory.newChannelProperties(TEST_CHANNEL_PROPERTIES);
AgentProperty agentProperty = new AgentPropertyChannelAdaptor(channelProperties);
this.agentEventAsyncTaskService.handleEvent(agentProperty, TEST_EVENT_TIMESTAMP, expectedEventType);
verify(this.agentEventService, times(1)).insert(argCaptor.capture());
// then
AgentEventBo actualAgentEventBo = argCaptor.getValue();
assertEquals(TEST_AGENT_ID, actualAgentEventBo.getAgentId());
assertEquals(TEST_START_TIMESTAMP, actualAgentEventBo.getStartTimestamp());
assertEquals(TEST_EVENT_TIMESTAMP, actualAgentEventBo.getEventTimestamp());
assertEquals(expectedEventType, actualAgentEventBo.getEventType());
assertEquals(0, actualAgentEventBo.getEventBody().length);
}
use of com.navercorp.pinpoint.common.server.bo.event.AgentEventBo in project pinpoint by naver.
the class ThriftAgentEventMapperTest method simpleTest1.
@Test
public void simpleTest1() {
final String agentId = "agentId";
final long startTimestamp = Long.MAX_VALUE;
final long eventTimestamp = startTimestamp;
final TAgentStat agentStat = createAgentStat(agentId, startTimestamp, eventTimestamp, 2);
DeadlockBo deadlockBo = new DeadlockBo();
deadlockBo.setDeadlockedThreadCount(agentStat.getDeadlock().getDeadlockedThreadCount());
DeadlockEventBo expectedEventBo = new DeadlockEventBo(agentId, startTimestamp, eventTimestamp, AgentEventType.AGENT_DEADLOCK_DETECTED, deadlockBo);
when(this.deadlockEventBoMapper.map(agentId, startTimestamp, startTimestamp, agentStat.getDeadlock())).thenReturn(expectedEventBo);
AgentEventBo actualEventBo = agentEventMapper.map(agentStat);
Assert.assertEquals(expectedEventBo, actualEventBo);
}
use of com.navercorp.pinpoint.common.server.bo.event.AgentEventBo in project pinpoint by naver.
the class AgentEventServiceImpl method getAgentEvent.
@Override
public AgentEvent getAgentEvent(String agentId, long eventTimestamp, AgentEventType eventType) {
Objects.requireNonNull(agentId, "agentId");
if (eventTimestamp < 0) {
throw new IllegalArgumentException("eventTimeTimestamp must not be less than 0");
}
Objects.requireNonNull(eventType, "eventType");
final boolean includeEventMessage = true;
AgentEventBo agentEventBo = this.agentEventDao.getAgentEvent(agentId, eventTimestamp, eventType);
if (agentEventBo != null) {
return createAgentEvent(agentEventBo, includeEventMessage);
}
return null;
}
Aggregations