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();
}
}
}
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;
}
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;
}
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;
}
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;
}
Aggregations