Search in sources :

Example 86 with Application

use of com.navercorp.pinpoint.web.vo.Application in project pinpoint by naver.

the class ApplicationNameMapper method mapRow.

@Override
public List<Application> mapRow(Result result, int rowNum) throws Exception {
    if (result.isEmpty()) {
        return Collections.emptyList();
    }
    Set<Short> uniqueTypeCodes = new HashSet<>();
    String applicationName = Bytes.toString(result.getRow());
    Cell[] rawCells = result.rawCells();
    for (Cell cell : rawCells) {
        short serviceTypeCode = Bytes.toShort(CellUtil.cloneValue(cell));
        uniqueTypeCodes.add(serviceTypeCode);
    }
    List<Application> applicationList = new ArrayList<>();
    for (short serviceTypeCode : uniqueTypeCodes) {
        final Application application = applicationFactory.createApplication(applicationName, serviceTypeCode);
        applicationList.add(application);
    }
    return applicationList;
}
Also used : ArrayList(java.util.ArrayList) Cell(org.apache.hadoop.hbase.Cell) Application(com.navercorp.pinpoint.web.vo.Application) HashSet(java.util.HashSet)

Example 87 with Application

use of com.navercorp.pinpoint.web.vo.Application 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 88 with Application

use of com.navercorp.pinpoint.web.vo.Application in project pinpoint by naver.

the class AdminServiceImpl method getAgentIdMap.

@Override
public Map<String, List<Application>> getAgentIdMap() {
    Map<String, List<Application>> agentIdMap = new TreeMap<>(Ordering.usingToString());
    List<Application> applications = this.applicationIndexDao.selectAllApplicationNames();
    for (Application application : applications) {
        List<String> agentIds = this.applicationIndexDao.selectAgentIds(application.getName());
        for (String agentId : agentIds) {
            if (!agentIdMap.containsKey(agentId)) {
                agentIdMap.put(agentId, new ArrayList<Application>());
            }
            agentIdMap.get(agentId).add(application);
        }
    }
    return agentIdMap;
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) TreeMap(java.util.TreeMap) Application(com.navercorp.pinpoint.web.vo.Application)

Example 89 with Application

use of com.navercorp.pinpoint.web.vo.Application in project pinpoint by naver.

the class AdminServiceImpl method removeInactiveAgents.

@Override
public void removeInactiveAgents(int durationDays) {
    if (durationDays < MIN_DURATION_DAYS_FOR_INACTIVITY) {
        throw new IllegalArgumentException("duration may not be less than " + MIN_DURATION_DAYS_FOR_INACTIVITY + " days");
    }
    Map<String, List<String>> inactiveAgentMap = new TreeMap<>(Ordering.usingToString());
    List<Application> applications = this.applicationIndexDao.selectAllApplicationNames();
    Set<String> applicationNames = new TreeSet<>(Ordering.usingToString());
    // remove duplicates (same application name but different service type)
    for (Application application : applications) {
        applicationNames.add(application.getName());
    }
    for (String applicationName : applicationNames) {
        List<String> agentIds = this.applicationIndexDao.selectAgentIds(applicationName);
        Collections.sort(agentIds);
        List<String> inactiveAgentIds = filterInactiveAgents(agentIds, durationDays);
        if (!CollectionUtils.isEmpty(inactiveAgentIds)) {
            inactiveAgentMap.put(applicationName, inactiveAgentIds);
        }
    }
    // map may become big, but realistically won't cause OOM
    // if it becomes an issue, consider deleting inside the loop above
    logger.info("deleting {}", inactiveAgentMap);
    this.applicationIndexDao.deleteAgentIds(inactiveAgentMap);
}
Also used : TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) List(java.util.List) TreeMap(java.util.TreeMap) Application(com.navercorp.pinpoint.web.vo.Application)

Example 90 with Application

use of com.navercorp.pinpoint.web.vo.Application 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

Application (com.navercorp.pinpoint.web.vo.Application)90 Test (org.junit.Test)39 Rule (com.navercorp.pinpoint.web.alarm.vo.Rule)30 MapStatisticsCallerDataCollector (com.navercorp.pinpoint.web.alarm.collector.MapStatisticsCallerDataCollector)15 ResponseTimeDataCollector (com.navercorp.pinpoint.web.alarm.collector.ResponseTimeDataCollector)11 AcceptApplication (com.navercorp.pinpoint.web.service.map.AcceptApplication)11 RpcApplication (com.navercorp.pinpoint.web.service.map.RpcApplication)10 Range (com.navercorp.pinpoint.web.vo.Range)10 AgentHistogram (com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram)5 List (java.util.List)5 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)5 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)5 AgentStatDataCollector (com.navercorp.pinpoint.web.alarm.collector.AgentStatDataCollector)4 AgentHistogramList (com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogramList)4 LinkDataMap (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataMap)4 ArrayList (java.util.ArrayList)4 Buffer (com.navercorp.pinpoint.common.buffer.Buffer)3 ServiceType (com.navercorp.pinpoint.common.trace.ServiceType)3 ErrorCountToCalleeChecker (com.navercorp.pinpoint.web.alarm.checker.ErrorCountToCalleeChecker)3 ErrorRateToCalleeChecker (com.navercorp.pinpoint.web.alarm.checker.ErrorRateToCalleeChecker)3