本文整理匯總了Java中monitor.observer.DiagnosticDataPoint類的典型用法代碼示例。如果您正苦於以下問題:Java DiagnosticDataPoint類的具體用法?Java DiagnosticDataPoint怎麽用?Java DiagnosticDataPoint使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
DiagnosticDataPoint類屬於monitor.observer包,在下文中一共展示了DiagnosticDataPoint類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: merge
import monitor.observer.DiagnosticDataPoint; //導入依賴的package包/類
Statistics merge(DiagnosticDataPoint dataPoint) {
Map<String, LivenessQuota> newStatistics = new HashMap<>(livenessQuotaByService);
LivenessQuota oldServiceQuota = newStatistics.getOrDefault(dataPoint.service(), LivenessQuota.zero());
newStatistics.put(dataPoint.service(), oldServiceQuota.merge(dataPoint));
LivenessQuota newTotalQuota = totalLivenessQuota.merge(dataPoint);
return new Statistics(newTotalQuota, newStatistics);
}
示例2: updateStatistics
import monitor.observer.DiagnosticDataPoint; //導入依賴的package包/類
public void updateStatistics() {
List<DiagnosticDataPoint> newDataPoints = serviceObservers.stream()
.map(ServiceObserver::gatherDataFromService)
.collect(toList());
Statistics newStatistics = statistician.compute(currentStatistics, newDataPoints);
currentStatistics = newStatistics;
repository.store(newStatistics);
}
示例3: gatherDataFromService
import monitor.observer.DiagnosticDataPoint; //導入依賴的package包/類
@Override
public DiagnosticDataPoint gatherDataFromService() {
// this check should actually contact the serviceName
boolean alive = RANDOM.nextFloat() > 0.1;
return DiagnosticDataPoint.of(serviceName, ZonedDateTime.now(), alive);
}
示例4: aliveAsLong
import monitor.observer.DiagnosticDataPoint; //導入依賴的package包/類
private static long aliveAsLong(DiagnosticDataPoint dataPoint) {
return dataPoint.alive() ? 1 : 0;
}
示例5: compute
import monitor.observer.DiagnosticDataPoint; //導入依賴的package包/類
public Statistics compute(Statistics currentStats, Iterable<DiagnosticDataPoint> dataPoints) {
Statistics finalStats = currentStats;
for (DiagnosticDataPoint dataPoint : dataPoints)
finalStats = finalStats.merge(dataPoint);
return finalStats;
}
示例6: gatherDataFromService
import monitor.observer.DiagnosticDataPoint; //導入依賴的package包/類
@Override
public DiagnosticDataPoint gatherDataFromService() {
// this check should actually contact the serviceName
boolean alive = RANDOM.nextFloat() > 0.25;
return DiagnosticDataPoint.of(serviceName, ZonedDateTime.now(), alive);
}