use of com.axway.ats.common.performance.monitor.beans.BasicReadingBean in project ats-framework by Axway.
the class AtsSystemMonitor method doPoll.
public List<BasicReadingBean> doPoll(boolean isFirstTime) throws Exception {
List<BasicReadingBean> redingsResult = new ArrayList<BasicReadingBean>();
// clear the values from previous poll for all parent processes
for (ParentProcessReadingBean parentProcessReading : parentProcessReadingInstances.values()) {
parentProcessReading.resetValue();
}
// update the list of dynamic reading instances
if (initialDynamicReadings.size() > 0) {
dynamicReadingInstances = ReadingInstancesFactory.createOrUpdateDynamicReadingInstances(sigarWrapper, parentProcessReadingInstances, initialDynamicReadings, dynamicReadingInstances);
}
// refresh the Sigar's info
this.sigarWrapper.refresh();
// poll the static reading instances
redingsResult.addAll(pollReadingInstances(staticReadingInstances));
// poll the dynamic reading instances
if (initialDynamicReadings.size() > 0) {
redingsResult.addAll(pollReadingInstances(dynamicReadingInstances));
}
// add the parent process values
redingsResult.addAll(pollParentProcessInstances(parentProcessReadingInstances.values()));
return redingsResult;
}
use of com.axway.ats.common.performance.monitor.beans.BasicReadingBean in project ats-framework by Axway.
the class AtsSystemMonitor method pollParentProcessInstances.
private List<BasicReadingBean> pollParentProcessInstances(Collection<ParentProcessReadingBean> parentProcessReadingInstances) {
List<BasicReadingBean> redingsResult = new ArrayList<BasicReadingBean>();
for (ParentProcessReadingBean readingInstance : parentProcessReadingInstances) {
// get the collected value from all children
float value = readingInstance.poll();
BasicReadingBean newResult;
if (readingInstance.isNewInstance()) {
readingInstance.setNewInstanceFlag(false);
// the Test Executor needs to be informed about this reading instance
// we pass back a Full Reading Bean
newResult = readingInstance.getNewCopy();
} else {
// the Test Executor is already aware we are collecting data about this reading instance
newResult = new BasicReadingBean();
newResult.setId(readingInstance.getId());
}
newResult.setValue(String.valueOf(value));
redingsResult.add(newResult);
}
return redingsResult;
}
use of com.axway.ats.common.performance.monitor.beans.BasicReadingBean in project ats-framework by Axway.
the class UserActivityLoggerTask method parseReadingsAndMoveToTempRepository.
/**
* We cannot send a reading for a timestamp before we get it from all agents
*
* @param monitoredAgent
* @param newResults
*/
private void parseReadingsAndMoveToTempRepository(String monitoredAgent, List<MonitorResults> newMonitorResults) {
// counter for user info
int resultsRead = 0;
for (MonitorResults newMonitorResult : newMonitorResults) {
// update the collect times for this loader
Integer currentCollectTimes = this.collectTimesPerLoader.get(monitoredAgent);
if (currentCollectTimes == null) {
// this is the first time
this.collectTimesPerLoader.put(monitoredAgent, 0);
} else {
// increment
this.collectTimesPerLoader.put(monitoredAgent, currentCollectTimes + 1);
}
// assign DB IDs to these readings if needed
List<BasicReadingBean> newReadings = newMonitorResult.getReadings();
updateDatabaseRepository(monitoredAgent, newReadings);
// Map<reading ID, reading value>
Map<String, Integer> readingsMap = new HashMap<String, Integer>();
for (BasicReadingBean newReading : newReadings) {
readingsMap.put(newReading.getId(), Integer.valueOf(newReading.getValue()));
resultsRead++;
}
// remember the readings info for later commit
this.readingsTempStorage.addReadings(newMonitorResult.getTimestamp(), readingsMap);
}
log.debug("Successfully read " + resultsRead + " user activity results from " + monitoredAgent);
}
use of com.axway.ats.common.performance.monitor.beans.BasicReadingBean in project ats-framework by Axway.
the class AtsSystemMonitor method pollReadingInstances.
private List<BasicReadingBean> pollReadingInstances(List<ReadingInstance> readingInstances) throws Exception {
List<BasicReadingBean> redingsResult = new ArrayList<BasicReadingBean>();
for (ReadingInstance readingInstance : readingInstances) {
float value = readingInstance.poll();
BasicReadingBean newResult;
if (readingInstance.isNewInstance()) {
readingInstance.setNewInstanceFlag(false);
// the Test Executor needs to be informed about this reading instance
// we pass back a Full Reading Bean
newResult = readingInstance.getNewCopy();
} else {
// the Test Executor is already aware we are collecting data about this reading instance
newResult = new BasicReadingBean();
newResult.setId(readingInstance.getId());
}
newResult.setValue(String.valueOf(value));
redingsResult.add(newResult);
}
return redingsResult;
}
use of com.axway.ats.common.performance.monitor.beans.BasicReadingBean in project ats-framework by Axway.
the class AtsJvmMonitor method pollReadingInstances.
private List<BasicReadingBean> pollReadingInstances(List<JvmReadingInstance> readingInstances) throws Exception {
List<BasicReadingBean> redingsResult = new ArrayList<BasicReadingBean>();
for (JvmReadingInstance readingInstance : readingInstances) {
float value = readingInstance.poll();
BasicReadingBean newResult;
if (readingInstance.isNewInstance()) {
readingInstance.setNewInstanceFlag(false);
// the Test Executor needs to be informed about this reading instance
// we pass back a Full Reading Bean
newResult = readingInstance.getNewCopy();
} else {
// the Test Executor is already aware we are collecting data about this reading instance
newResult = new BasicReadingBean();
newResult.setId(readingInstance.getId());
}
newResult.setValue(String.valueOf(value));
redingsResult.add(newResult);
}
return redingsResult;
}
Aggregations