Search in sources :

Example 6 with LinkDataMap

use of com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataMap in project pinpoint by naver.

the class MapStatisticsCalleeMapper method mapRow.

@Override
public LinkDataMap mapRow(Result result, int rowNum) throws Exception {
    if (result.isEmpty()) {
        return new LinkDataMap();
    }
    logger.debug("mapRow:{}", rowNum);
    final byte[] rowKey = getOriginalKey(result.getRow());
    final Buffer row = new FixedBuffer(rowKey);
    final Application calleeApplication = readCalleeApplication(row);
    final long timestamp = TimeUtils.recoveryTimeMillis(row.readLong());
    final LinkDataMap linkDataMap = new LinkDataMap();
    for (Cell cell : result.rawCells()) {
        final byte[] qualifier = CellUtil.cloneQualifier(cell);
        final Application callerApplication = readCallerApplication(qualifier, calleeApplication.getServiceType());
        if (filter.filter(callerApplication)) {
            continue;
        }
        long requestCount = Bytes.toLong(cell.getValueArray(), cell.getValueOffset());
        short histogramSlot = ApplicationMapStatisticsUtils.getHistogramSlotFromColumnName(qualifier);
        String callerHost = ApplicationMapStatisticsUtils.getHost(qualifier);
        boolean isError = histogramSlot == (short) -1;
        if (logger.isDebugEnabled()) {
            logger.debug("    Fetched Callee. {} callerHost:{} -> {} (slot:{}/{}),  ", callerApplication, callerHost, calleeApplication, histogramSlot, requestCount);
        }
        final short slotTime = (isError) ? (short) -1 : histogramSlot;
        linkDataMap.addLinkData(callerApplication, callerApplication.getName(), calleeApplication, callerHost, timestamp, slotTime, requestCount);
        if (logger.isDebugEnabled()) {
            logger.debug("    Fetched Callee. statistics:{}", linkDataMap);
        }
    }
    return linkDataMap;
}
Also used : FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer) Buffer(com.navercorp.pinpoint.common.buffer.Buffer) FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer) Application(com.navercorp.pinpoint.web.vo.Application) Cell(org.apache.hadoop.hbase.Cell) LinkDataMap(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataMap)

Example 7 with LinkDataMap

use of com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataMap in project pinpoint by naver.

the class MapStatisticsCallerMapper method mapRow.

@Override
public LinkDataMap mapRow(Result result, int rowNum) throws Exception {
    if (result.isEmpty()) {
        return new LinkDataMap();
    }
    logger.debug("mapRow:{}", rowNum);
    final byte[] rowKey = getOriginalKey(result.getRow());
    final Buffer row = new FixedBuffer(rowKey);
    final Application caller = readCallerApplication(row);
    final long timestamp = TimeUtils.recoveryTimeMillis(row.readLong());
    // key is destApplicationName.
    final LinkDataMap linkDataMap = new LinkDataMap();
    for (Cell cell : result.rawCells()) {
        final Buffer buffer = new OffsetFixedBuffer(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength());
        final Application callee = readCalleeApplication(buffer);
        if (filter.filter(callee)) {
            continue;
        }
        String calleeHost = buffer.readPrefixedString();
        short histogramSlot = buffer.readShort();
        boolean isError = histogramSlot == (short) -1;
        String callerAgentId = buffer.readPrefixedString();
        long requestCount = getValueToLong(cell);
        if (logger.isDebugEnabled()) {
            logger.debug("    Fetched Caller.(New) {} {} -> {} (slot:{}/{}) calleeHost:{}", caller, callerAgentId, callee, histogramSlot, requestCount, calleeHost);
        }
        final short slotTime = (isError) ? (short) -1 : histogramSlot;
        if (StringUtils.isEmpty(calleeHost)) {
            calleeHost = callee.getName();
        }
        linkDataMap.addLinkData(caller, callerAgentId, callee, calleeHost, timestamp, slotTime, requestCount);
    }
    return linkDataMap;
}
Also used : FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer) Buffer(com.navercorp.pinpoint.common.buffer.Buffer) OffsetFixedBuffer(com.navercorp.pinpoint.common.buffer.OffsetFixedBuffer) FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer) OffsetFixedBuffer(com.navercorp.pinpoint.common.buffer.OffsetFixedBuffer) OffsetFixedBuffer(com.navercorp.pinpoint.common.buffer.OffsetFixedBuffer) Application(com.navercorp.pinpoint.web.vo.Application) Cell(org.apache.hadoop.hbase.Cell) LinkDataMap(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataMap)

Aggregations

LinkDataMap (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataMap)7 Application (com.navercorp.pinpoint.web.vo.Application)4 TimeWindow (com.navercorp.pinpoint.web.util.TimeWindow)3 Buffer (com.navercorp.pinpoint.common.buffer.Buffer)2 FixedBuffer (com.navercorp.pinpoint.common.buffer.FixedBuffer)2 Cell (org.apache.hadoop.hbase.Cell)2 Scan (org.apache.hadoop.hbase.client.Scan)2 OffsetFixedBuffer (com.navercorp.pinpoint.common.buffer.OffsetFixedBuffer)1 SpanBo (com.navercorp.pinpoint.common.server.bo.SpanBo)1 SpanEventBo (com.navercorp.pinpoint.common.server.bo.SpanEventBo)1 ServiceType (com.navercorp.pinpoint.common.trace.ServiceType)1 ApplicationMap (com.navercorp.pinpoint.web.applicationmap.ApplicationMap)1 ApplicationMapBuilder (com.navercorp.pinpoint.web.applicationmap.ApplicationMapBuilder)1 LinkCallData (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkCallData)1 LinkCallDataMap (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkCallDataMap)1 LinkData (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkData)1 LinkDataDuplexMap (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataDuplexMap)1 Range (com.navercorp.pinpoint.web.vo.Range)1 ResponseHistogramBuilder (com.navercorp.pinpoint.web.vo.ResponseHistogramBuilder)1