@Override public ServiceStat createStat(PerfCounterInfo pc, List<PerfSampleInfo> infos, List<Long> values) { if (infos == null || infos.isEmpty()) { return null; } ServiceStat res = new ServiceStat(); res.name = this.name; res.unit = this.unit; PerfSampleInfo info = null; double converted = 0; int intervalLengthMinutes = 5; res.timeSeriesStats = new TimeSeriesStats(24 * 60 / intervalLengthMinutes, intervalLengthMinutes * 60 * 1000, EnumSet.allOf(AggregationType.class)); for (int i = 0; i < infos.size(); i++) { info = infos.get(i); Long value = values.get(i); converted = convertValue(value); res.timeSeriesStats.add(getSampleTimestampMicros(info), converted, converted); } res.sourceTimeMicrosUtc = res.lastUpdateMicrosUtc = getSampleTimestampMicros(info); res.latestValue = converted; return res; }
private long getSampleTimestampMicros(PerfSampleInfo info) { return info.getTimestamp().toGregorianCalendar().getTimeInMillis() * 1000; }
ServiceStat createStat(PerfCounterInfo counter, List<PerfSampleInfo> infos, List<Long> data);