use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.
the class RedisPluginTest method jedis.
@Test
public void jedis() {
JedisMock jedis = new JedisMock("localhost", 6379);
try {
jedis.get("foo");
} finally {
if (jedis != null) {
jedis.close();
}
}
final List<SpanEventBo> events = getCurrentSpanEvents();
assertEquals(1, events.size());
final SpanEventBo eventBo = events.get(0);
assertEquals(HOST + ":" + PORT, eventBo.getEndPoint());
assertEquals("REDIS", eventBo.getDestinationId());
}
use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.
the class FilteredMapServiceImpl method linkStatistics.
@Override
@Deprecated
public LoadFactor linkStatistics(Range range, List<TransactionId> traceIdSet, Application sourceApplication, Application destinationApplication, Filter filter) {
if (sourceApplication == null) {
throw new NullPointerException("sourceApplication must not be null");
}
if (destinationApplication == null) {
throw new NullPointerException("destApplicationName must not be null");
}
if (filter == null) {
throw new NullPointerException("filter must not be null");
}
StopWatch watch = new StopWatch();
watch.start();
List<List<SpanBo>> originalList = this.traceDao.selectAllSpans(traceIdSet);
List<SpanBo> filteredTransactionList = filterList(originalList, filter);
LoadFactor statistics = new LoadFactor(range);
// scan transaction list
for (SpanBo span : filteredTransactionList) {
if (sourceApplication.equals(span.getApplicationId(), registry.findServiceType(span.getApplicationServiceType()))) {
List<SpanEventBo> spanEventBoList = span.getSpanEventBoList();
if (spanEventBoList == null) {
continue;
}
// find dest elapsed time
for (SpanEventBo spanEventBo : spanEventBoList) {
if (destinationApplication.equals(spanEventBo.getDestinationId(), registry.findServiceType(spanEventBo.getServiceType()))) {
// find exception
boolean hasException = spanEventBo.hasException();
// add sample
// TODO : need timeslot value instead of the actual value
statistics.addSample(span.getStartTime() + spanEventBo.getStartElapsed(), spanEventBo.getEndElapsed(), 1, hasException);
break;
}
}
}
}
watch.stop();
logger.info("Fetch link statistics elapsed. {}ms", watch.getLastTaskTimeMillis());
return statistics;
}
use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.
the class FilteredMapServiceImpl method addNodeFromSpanEvent.
private void addNodeFromSpanEvent(SpanBo span, TimeWindow window, LinkDataDuplexMap linkDataDuplexMap, Map<Long, SpanBo> transactionSpanMap) {
/*
* add span event statistics
*/
final List<SpanEventBo> spanEventBoList = span.getSpanEventBoList();
if (CollectionUtils.isEmpty(spanEventBoList)) {
return;
}
final Application srcApplication = applicationFactory.createApplication(span.getApplicationId(), span.getApplicationServiceType());
LinkDataMap sourceLinkDataMap = linkDataDuplexMap.getSourceLinkDataMap();
for (SpanEventBo spanEvent : spanEventBoList) {
ServiceType destServiceType = registry.findServiceType(spanEvent.getServiceType());
if (!destServiceType.isRecordStatistics()) {
// internal method
continue;
}
// logic for checking acceptor
if (destServiceType.isRpcClient()) {
if (!transactionSpanMap.containsKey(spanEvent.getNextSpanId())) {
destServiceType = ServiceType.UNKNOWN;
}
}
String dest = spanEvent.getDestinationId();
if (dest == null) {
dest = "Unknown";
}
final Application destApplication = this.applicationFactory.createApplication(dest, destServiceType);
final short slotTime = getHistogramSlotTime(spanEvent, destServiceType);
// FIXME
final long spanEventTimeStamp = window.refineTimestamp(span.getStartTime() + spanEvent.getStartElapsed());
if (logger.isTraceEnabled()) {
logger.trace("spanEvent src:{} {} -> dest:{} {}", srcApplication, span.getAgentId(), destApplication, spanEvent.getEndPoint());
}
// endPoint may be null
final String destinationAgentId = StringUtils.defaultString(spanEvent.getEndPoint());
sourceLinkDataMap.addLinkData(srcApplication, span.getAgentId(), destApplication, destinationAgentId, spanEventTimeStamp, slotTime, 1);
}
}
use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.
the class SpanHandler method insertSpanEventStat.
private void insertSpanEventStat(SpanBo span) {
final List<SpanEventBo> spanEventList = span.getSpanEventBoList();
if (CollectionUtils.isEmpty(spanEventList)) {
return;
}
final ServiceType applicationServiceType = getApplicationServiceType(span);
logger.debug("handle spanEvent size:{}", spanEventList.size());
// TODO need to batch update later.
for (SpanEventBo spanEvent : spanEventList) {
final ServiceType spanEventType = registry.findServiceType(spanEvent.getServiceType());
if (!spanEventType.isRecordStatistics()) {
continue;
}
// if terminal update statistics
final int elapsed = spanEvent.getEndElapsed();
final boolean hasException = spanEvent.hasException();
/*
* save information to draw a server map based on statistics
*/
// save the information of caller (the spanevent that called span)
statisticsHandler.updateCaller(span.getApplicationId(), applicationServiceType, span.getAgentId(), spanEvent.getDestinationId(), spanEventType, spanEvent.getEndPoint(), elapsed, hasException);
// save the information of callee (the span that spanevent called)
statisticsHandler.updateCallee(spanEvent.getDestinationId(), spanEventType, span.getApplicationId(), applicationServiceType, span.getEndPoint(), elapsed, hasException);
}
}
use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.
the class SequenceSpanEventFilterTest method testFilter_accept.
@Test
public void testFilter_accept() throws Exception {
SpanEventFilter filter = new SequenceSpanEventFilter(100);
final SpanEventBo spanEventBo = new SpanEventBo();
spanEventBo.setSequence((short) 11);
Assert.assertEquals(filter.filter(spanEventBo), SpanEventFilter.ACCEPT);
}
Aggregations