use of com.navercorp.pinpoint.common.server.bo.event.AgentEventBo in project pinpoint by naver.
the class ThriftAgentEventMapperTest method simpleTest2.
@Test
public void simpleTest2() {
final String agentId = "agentId";
final long startTimestamp = Long.MAX_VALUE;
final long eventTimestamp = startTimestamp;
final TAgentStat agentStat = createAgentStat(agentId, startTimestamp, eventTimestamp, 0);
DeadlockBo deadlockBo = new DeadlockBo();
DeadlockEventBo expectedEventBo = new DeadlockEventBo(agentId, startTimestamp, eventTimestamp, AgentEventType.AGENT_DEADLOCK_DETECTED, deadlockBo);
when(this.deadlockEventBoMapper.map(any(String.class), any(Long.class), any(Long.class), any(TDeadlock.class))).thenReturn(expectedEventBo);
AgentEventBo actualEventBo = agentEventMapper.map(agentStat);
Assert.assertNull(actualEventBo);
}
use of com.navercorp.pinpoint.common.server.bo.event.AgentEventBo in project pinpoint by naver.
the class HbaseAgentEventDao method getAgentEvent.
@Override
public AgentEventBo getAgentEvent(String agentId, long eventTimestamp, AgentEventType eventType) {
Objects.requireNonNull(agentId, "agentId");
if (eventTimestamp < 0) {
throw new IllegalArgumentException("eventTimestamp must not be less than 0");
}
Objects.requireNonNull(eventType, "eventType");
final byte[] rowKey = createRowKey(agentId, eventTimestamp);
byte[] qualifier = Bytes.toBytes(eventType.getCode());
TableName agentEventTableName = tableNameProvider.getTableName(DESCRIPTOR.getTable());
List<AgentEventBo> events = this.hbaseOperations2.get(agentEventTableName, rowKey, DESCRIPTOR.getName(), qualifier, this.agentEventMapper);
if (CollectionUtils.isEmpty(events)) {
return null;
}
return events.get(0);
}
use of com.navercorp.pinpoint.common.server.bo.event.AgentEventBo in project pinpoint by naver.
the class HbaseAgentEventDao method getAgentEvents.
@Override
public List<AgentEventBo> getAgentEvents(String agentId, Range range, Set<AgentEventType> excludeEventTypes) {
Objects.requireNonNull(agentId, "agentId");
Objects.requireNonNull(range, "range");
Scan scan = new Scan();
scan.setMaxVersions(1);
scan.setCaching(SCANNER_CACHE_SIZE);
scan.withStartRow(createRowKey(agentId, range.getTo()));
scan.withStopRow(createRowKey(agentId, range.getFrom()));
scan.addFamily(DESCRIPTOR.getName());
if (CollectionUtils.hasLength(excludeEventTypes)) {
FilterList filterList = new FilterList(FilterList.Operator.MUST_PASS_ALL);
for (AgentEventType excludeEventType : excludeEventTypes) {
byte[] excludeQualifier = Bytes.toBytes(excludeEventType.getCode());
filterList.addFilter(new QualifierFilter(CompareFilter.CompareOp.NOT_EQUAL, new BinaryComparator(excludeQualifier)));
}
scan.setFilter(filterList);
}
TableName agentEventTableName = tableNameProvider.getTableName(DESCRIPTOR.getTable());
List<AgentEventBo> agentEvents = this.hbaseOperations2.find(agentEventTableName, scan, agentEventResultsExtractor);
logger.debug("agentEvents found. {}", agentEvents);
return agentEvents;
}
use of com.navercorp.pinpoint.common.server.bo.event.AgentEventBo in project pinpoint by naver.
the class AgentEventDataCollector method collect.
@Override
public void collect() {
if (init.get()) {
return;
}
Range range = Range.newUncheckedRange(timeSlotEndTime - slotInterval, timeSlotEndTime);
List<String> agentIds = applicationIndexDao.selectAgentIds(application.getName());
for (String agentId : agentIds) {
List<AgentEventBo> agentEventBoList = agentEventDao.getAgentEvents(agentId, range, Collections.emptySet());
if (hasDeadlockEvent(agentEventBoList)) {
agentDeadlockEventDetected.put(agentId, true);
}
}
init.set(true);
}
use of com.navercorp.pinpoint.common.server.bo.event.AgentEventBo in project pinpoint by naver.
the class AgentEventHandlingFilter method insertResponseEvent.
private void insertResponseEvent(ResponseEvent responseEvent, long eventTimestamp) {
final TCommandTransfer command = responseEvent.getDeliveryCommand();
final String agentId = command.getAgentId();
final long startTimestamp = command.getStartTime();
final TCommandTransferResponse response = responseEvent.getRouteResult();
final byte[] payload = response.getPayload();
final Class<?> payloadType = readPayload(payload);
if (payload == null) {
return;
}
for (AgentEventType eventType : RESPONSE_EVENT_TYPES) {
if (eventType.getMessageType() == payloadType) {
final AgentEventBo agentEventBo = new AgentEventBo(agentId, startTimestamp, eventTimestamp, eventType);
agentEventBo.setEventBody(payload);
this.agentEventService.insert(agentEventBo);
}
}
}
Aggregations