Returns the statistics for a load-balanced server instance
LoadBalancerStatsInterface lbstats = lbff.getLoadBalancerMonitoringStats(lbConfigName,lbName);
Statistic[] statArr1 = new Statistic[3];
StringStatistic stat11 = new StringStatisticImpl("Health", "Instance Health", "state of the server", 0, 0, "");
CountStatistic stat21 = new CountStatisticImpl("NumberOfActiveRequests", "Number Of Active Requests", "count", 0, 0, 0);
CountStatistic stat31 = new CountStatisticImpl("NumberOfTotalRequests", "Number Of Total Requests", "count", 0, 0, 0);
statArr1[0]=stat11;
statArr1[1]=stat21;
statArr1[2]=stat31;
if(lbstats == null)
return statArr1;
ClusterStats [] cstats = lbstats.getClusterStats();
for(ClusterStats cstat :cstats){
for(InstanceStats istat : cstat.getInstanceStats()){
if(!istat.getId().equals(instanceName))
continue;
Statistic[] statArr = new Statistic[3];
String health = istat.getHealth();
long activeReq = Long.parseLong(istat.getNumActiveRequests());
long totalReq = Long.parseLong(istat.getNumTotalRequests());
long sampleTime = new Date().getTime();
StringStatistic stat1 = new StringStatisticImpl("Health", "Instance Health", "milliseconds", startTime, sampleTime, health);
CountStatistic stat2 = new CountStatisticImpl("NumberOfActiveRequests", "Number Of Active Requests", "count", startTime, sampleTime, activeReq);
CountStatistic stat3 = new CountStatisticImpl("NumberOfTotalRequests", "Number Of Total Requests", "count", startTime, sampleTime, totalReq);
statArr[0] = stat1;
statArr[1] = stat2;
statArr[2] = stat3;
return statArr;
}
}
return null;