Search in sources :

Example 6 with AgentInfo

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

the class ActiveThreadCountResponseAggregator method addWebSocketSession.

@Override
public void addWebSocketSession(WebSocketSession webSocketSession) {
    if (webSocketSession == null) {
        return;
    }
    logger.info("addWebSocketSession. applicationName:{}, webSocketSession:{}", applicationName, webSocketSession);
    List<AgentInfo> agentInfoList = agentService.getRecentAgentInfoList(applicationName);
    synchronized (workerManagingLock) {
        if (isStopped) {
            return;
        }
        for (AgentInfo agentInfo : agentInfoList) {
            AgentStatus agentStatus = agentInfo.getStatus();
            if (agentStatus != null && agentStatus.getState() != AgentLifeCycleState.UNKNOWN) {
                activeWorker(agentInfo);
            } else if (agentService.isConnected(agentInfo)) {
                activeWorker(agentInfo);
            }
        }
        boolean added = webSocketSessions.add(webSocketSession);
        if (added && webSocketSessions.size() == 1) {
            workerActiveManager.startAgentCheckJob();
        }
    }
}
Also used : AgentStatus(com.navercorp.pinpoint.web.vo.AgentStatus) AgentInfo(com.navercorp.pinpoint.web.vo.AgentInfo)

Example 7 with AgentInfo

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

the class AgentInfoServiceImpl method getApplicationAgentHostList.

@Override
public ApplicationAgentHostList getApplicationAgentHostList(int offset, int limit) {
    if (offset <= 0 || limit <= 0) {
        throw new IllegalArgumentException("Value must be greater than 0.");
    }
    List<String> applicationNameList = getApplicationNameList(applicationIndexDao.selectAllApplicationNames());
    if (offset > applicationNameList.size()) {
        return new ApplicationAgentHostList(offset, offset, applicationNameList.size());
    }
    long timeStamp = System.currentTimeMillis();
    int startIndex = offset - 1;
    int endIndex = Math.min(startIndex + limit, applicationNameList.size());
    ApplicationAgentHostList applicationAgentHostList = new ApplicationAgentHostList(offset, endIndex, applicationNameList.size());
    for (int i = startIndex; i < endIndex; i++) {
        String applicationName = applicationNameList.get(i);
        List<String> agentIds = this.applicationIndexDao.selectAgentIds(applicationName);
        List<AgentInfo> agentInfoList = this.agentInfoDao.getAgentInfos(agentIds, timeStamp);
        applicationAgentHostList.put(applicationName, agentInfoList);
    }
    return applicationAgentHostList;
}
Also used : ApplicationAgentHostList(com.navercorp.pinpoint.web.vo.ApplicationAgentHostList) AgentInfo(com.navercorp.pinpoint.web.vo.AgentInfo)

Example 8 with AgentInfo

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

the class AgentInfoServiceImpl method getRecentAgentsByApplicationName.

@Override
public Set<AgentInfo> getRecentAgentsByApplicationName(String applicationName, long timestamp, long timeDiff) {
    if (timeDiff > timestamp) {
        throw new IllegalArgumentException("timeDiff must not be greater than timestamp");
    }
    Set<AgentInfo> unfilteredAgentInfos = this.getAgentsByApplicationName(applicationName, timestamp);
    final long eventTimestampFloor = timestamp - timeDiff;
    Set<AgentInfo> filteredAgentInfos = new HashSet<>();
    for (AgentInfo agentInfo : unfilteredAgentInfos) {
        AgentStatus agentStatus = agentInfo.getStatus();
        if (AgentLifeCycleState.UNKNOWN == agentStatus.getState() || eventTimestampFloor <= agentStatus.getEventTimestamp()) {
            filteredAgentInfos.add(agentInfo);
        }
    }
    return filteredAgentInfos;
}
Also used : AgentStatus(com.navercorp.pinpoint.web.vo.AgentStatus) AgentInfo(com.navercorp.pinpoint.web.vo.AgentInfo) HashSet(java.util.HashSet)

Example 9 with AgentInfo

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

the class AgentServiceImpl method getAgentInfo.

@Override
public AgentInfo getAgentInfo(String applicationName, String agentId) {
    long currentTime = System.currentTimeMillis();
    Set<AgentInfo> agentInfos = agentInfoService.getAgentsByApplicationName(applicationName, currentTime);
    for (AgentInfo agentInfo : agentInfos) {
        if (agentInfo == null) {
            continue;
        }
        if (!agentInfo.getApplicationName().equals(applicationName)) {
            continue;
        }
        if (!agentInfo.getAgentId().equals(agentId)) {
            continue;
        }
        return agentInfo;
    }
    return null;
}
Also used : AgentInfo(com.navercorp.pinpoint.web.vo.AgentInfo)

Example 10 with AgentInfo

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

the class AgentServiceImpl method getRecentAgentInfoList.

@Override
public List<AgentInfo> getRecentAgentInfoList(String applicationName, long timeDiff) {
    List<AgentInfo> agentInfoList = new ArrayList<>();
    long currentTime = System.currentTimeMillis();
    Set<AgentInfo> agentInfos = agentInfoService.getRecentAgentsByApplicationName(applicationName, currentTime, timeDiff);
    for (AgentInfo agentInfo : agentInfos) {
        ListUtils.addIfValueNotNull(agentInfoList, agentInfo);
    }
    return agentInfoList;
}
Also used : ArrayList(java.util.ArrayList) AgentInfo(com.navercorp.pinpoint.web.vo.AgentInfo)

Aggregations

AgentInfo (com.navercorp.pinpoint.web.vo.AgentInfo)25 AgentStatus (com.navercorp.pinpoint.web.vo.AgentStatus)7 PinpointRouteResponse (com.navercorp.pinpoint.web.cluster.PinpointRouteResponse)5 HashSet (java.util.HashSet)5 Test (org.junit.Test)5 AgentLifeCycleBo (com.navercorp.pinpoint.common.server.bo.AgentLifeCycleBo)4 Scan (org.apache.hadoop.hbase.client.Scan)4 ResultsExtractor (com.navercorp.pinpoint.common.hbase.ResultsExtractor)3 AgentLifeCycleState (com.navercorp.pinpoint.common.server.util.AgentLifeCycleState)3 ArrayList (java.util.ArrayList)3 TableName (org.apache.hadoop.hbase.TableName)3 TException (org.apache.thrift.TException)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 AgentInfoBo (com.navercorp.pinpoint.common.server.bo.AgentInfoBo)2 NodeHistogram (com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram)2 DefaultPinpointRouteResponse (com.navercorp.pinpoint.web.cluster.DefaultPinpointRouteResponse)2 FailedPinpointRouteResponse (com.navercorp.pinpoint.web.cluster.FailedPinpointRouteResponse)2 AgentActiveThreadDumpFactory (com.navercorp.pinpoint.web.vo.AgentActiveThreadDumpFactory)2 AgentActiveThreadDumpList (com.navercorp.pinpoint.web.vo.AgentActiveThreadDumpList)2 ApplicationAgentHostList (com.navercorp.pinpoint.web.vo.ApplicationAgentHostList)2