本文整理汇总了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);
}