Search in sources :

Example 6 with AgentEventBo

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;
}
Also used : AgentEventBo(com.navercorp.pinpoint.common.server.bo.event.AgentEventBo)

Example 7 with 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;
}
Also used : AgentEventBo(com.navercorp.pinpoint.common.server.bo.event.AgentEventBo) AgentEvent(com.navercorp.pinpoint.web.vo.AgentEvent) AgentEventMarker(com.navercorp.pinpoint.web.vo.timeline.inspector.AgentEventMarker)

Example 8 with AgentEventBo

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);
}
Also used : ChannelProperties(com.navercorp.pinpoint.rpc.server.ChannelProperties) AgentEventType(com.navercorp.pinpoint.common.server.util.AgentEventType) AgentEventBo(com.navercorp.pinpoint.common.server.bo.event.AgentEventBo) AgentPropertyChannelAdaptor(com.navercorp.pinpoint.collector.service.async.AgentPropertyChannelAdaptor) AgentProperty(com.navercorp.pinpoint.collector.service.async.AgentProperty) Test(org.junit.Test)

Example 9 with AgentEventBo

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);
}
Also used : TAgentStat(com.navercorp.pinpoint.thrift.dto.TAgentStat) DeadlockBo(com.navercorp.pinpoint.common.server.bo.event.DeadlockBo) AgentEventBo(com.navercorp.pinpoint.common.server.bo.event.AgentEventBo) DeadlockEventBo(com.navercorp.pinpoint.common.server.bo.event.DeadlockEventBo) Test(org.junit.Test)

Example 10 with AgentEventBo

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;
}
Also used : AgentEventBo(com.navercorp.pinpoint.common.server.bo.event.AgentEventBo)

Aggregations

AgentEventBo (com.navercorp.pinpoint.common.server.bo.event.AgentEventBo)20 AgentEventType (com.navercorp.pinpoint.common.server.util.AgentEventType)5 ArrayList (java.util.ArrayList)5 Test (org.junit.Test)5 TAgentStat (com.navercorp.pinpoint.thrift.dto.TAgentStat)3 TCommandTransfer (com.navercorp.pinpoint.thrift.dto.command.TCommandTransfer)3 TCommandTransferResponse (com.navercorp.pinpoint.thrift.dto.command.TCommandTransferResponse)3 ResponseEvent (com.navercorp.pinpoint.collector.cluster.route.ResponseEvent)2 DeadlockBo (com.navercorp.pinpoint.common.server.bo.event.DeadlockBo)2 DeadlockEventBo (com.navercorp.pinpoint.common.server.bo.event.DeadlockEventBo)2 Header (com.navercorp.pinpoint.grpc.Header)2 HeaderV1 (com.navercorp.pinpoint.io.header.v1.HeaderV1)2 DefaultMessage (com.navercorp.pinpoint.io.request.DefaultMessage)2 TDeadlock (com.navercorp.pinpoint.thrift.dto.TDeadlock)2 HeaderTBaseDeserializer (com.navercorp.pinpoint.thrift.io.HeaderTBaseDeserializer)2 AgentEvent (com.navercorp.pinpoint.web.vo.AgentEvent)2 TableName (org.apache.hadoop.hbase.TableName)2 TBase (org.apache.thrift.TBase)2 AgentProperty (com.navercorp.pinpoint.collector.service.async.AgentProperty)1 AgentPropertyChannelAdaptor (com.navercorp.pinpoint.collector.service.async.AgentPropertyChannelAdaptor)1