|
@@ -1,274 +1,274 @@
|
|
|
-package cn.com.qmth.examcloud.web.actuator;
|
|
|
-
|
|
|
-import com.codahale.metrics.Timer;
|
|
|
-import com.codahale.metrics.*;
|
|
|
-import com.google.common.collect.Lists;
|
|
|
-
|
|
|
-import java.util.*;
|
|
|
-import java.util.concurrent.ScheduledExecutorService;
|
|
|
-import java.util.concurrent.TimeUnit;
|
|
|
-
|
|
|
-/**
|
|
|
- * 数据报告
|
|
|
- *
|
|
|
- * @author WANGWEI
|
|
|
- * @date 2019年7月25日
|
|
|
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
|
|
|
- */
|
|
|
-public class DataReportor extends ScheduledReporter {
|
|
|
-
|
|
|
- public static Builder forRegistry(MetricRegistry registry) {
|
|
|
- return new Builder(registry);
|
|
|
- }
|
|
|
-
|
|
|
- public static class Builder {
|
|
|
-
|
|
|
- private final MetricRegistry registry;
|
|
|
-
|
|
|
- private Clock clock;
|
|
|
-
|
|
|
- private TimeUnit rateUnit;
|
|
|
-
|
|
|
- private TimeUnit durationUnit;
|
|
|
-
|
|
|
- private MetricFilter filter;
|
|
|
-
|
|
|
- private ScheduledExecutorService executor;
|
|
|
-
|
|
|
- private boolean shutdownExecutorOnStop;
|
|
|
-
|
|
|
- private Set<MetricAttribute> disabledMetricAttributes;
|
|
|
-
|
|
|
- private Builder(MetricRegistry registry) {
|
|
|
- this.registry = registry;
|
|
|
- this.clock = Clock.defaultClock();
|
|
|
- this.rateUnit = TimeUnit.SECONDS;
|
|
|
- this.durationUnit = TimeUnit.MILLISECONDS;
|
|
|
- this.filter = MetricFilter.ALL;
|
|
|
- this.executor = null;
|
|
|
- this.shutdownExecutorOnStop = true;
|
|
|
- disabledMetricAttributes = Collections.emptySet();
|
|
|
- }
|
|
|
-
|
|
|
- public Builder shutdownExecutorOnStop(boolean shutdownExecutorOnStop) {
|
|
|
- this.shutdownExecutorOnStop = shutdownExecutorOnStop;
|
|
|
- return this;
|
|
|
- }
|
|
|
-
|
|
|
- public Builder scheduleOn(ScheduledExecutorService executor) {
|
|
|
- this.executor = executor;
|
|
|
- return this;
|
|
|
- }
|
|
|
-
|
|
|
- public Builder withClock(Clock clock) {
|
|
|
- this.clock = clock;
|
|
|
- return this;
|
|
|
- }
|
|
|
-
|
|
|
- public Builder convertRatesTo(TimeUnit rateUnit) {
|
|
|
- this.rateUnit = rateUnit;
|
|
|
- return this;
|
|
|
- }
|
|
|
-
|
|
|
- public Builder convertDurationsTo(TimeUnit durationUnit) {
|
|
|
- this.durationUnit = durationUnit;
|
|
|
- return this;
|
|
|
- }
|
|
|
-
|
|
|
- public Builder filter(MetricFilter filter) {
|
|
|
- this.filter = filter;
|
|
|
- return this;
|
|
|
- }
|
|
|
-
|
|
|
- public Builder disabledMetricAttributes(Set<MetricAttribute> disabledMetricAttributes) {
|
|
|
- this.disabledMetricAttributes = disabledMetricAttributes;
|
|
|
- return this;
|
|
|
- }
|
|
|
-
|
|
|
- public DataReportor build() {
|
|
|
- return new DataReportor(registry, clock, rateUnit, durationUnit, filter, executor,
|
|
|
- shutdownExecutorOnStop, disabledMetricAttributes);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- private final Clock clock;
|
|
|
-
|
|
|
- private ReportInfo reportInfo;
|
|
|
-
|
|
|
- private DataReportor(MetricRegistry registry, Clock clock, TimeUnit rateUnit,
|
|
|
- TimeUnit durationUnit, MetricFilter filter, ScheduledExecutorService executor,
|
|
|
- boolean shutdownExecutorOnStop, Set<MetricAttribute> disabledMetricAttributes) {
|
|
|
- super(registry, "data-reporter", filter, rateUnit, durationUnit, executor,
|
|
|
- shutdownExecutorOnStop, disabledMetricAttributes);
|
|
|
- this.clock = clock;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- @SuppressWarnings("rawtypes")
|
|
|
- public void report(SortedMap<String, Gauge> gauges, SortedMap<String, Counter> counters,
|
|
|
- SortedMap<String, Histogram> histograms, SortedMap<String, Meter> meters,
|
|
|
- SortedMap<String, Timer> timers) {
|
|
|
-
|
|
|
- ReportInfo info = new ReportInfo();
|
|
|
- info.setDateTime(new Date(clock.getTime()));
|
|
|
-
|
|
|
- final List<HistogramInfo> histogramInfoList = Lists.newArrayList();
|
|
|
- final List<TimerInfo> timerInfoList = Lists.newArrayList();
|
|
|
- final List<MeterInfo> meterInfoList = Lists.newArrayList();
|
|
|
- info.setHistogramInfoList(histogramInfoList);
|
|
|
- info.setMeterInfoList(meterInfoList);
|
|
|
- info.setTimerInfoList(timerInfoList);
|
|
|
-
|
|
|
- if (!histograms.isEmpty()) {
|
|
|
- for (Map.Entry<String, Histogram> entry : histograms.entrySet()) {
|
|
|
- HistogramInfo histogramInfo = getHistogramInfo(entry.getKey(), entry.getValue());
|
|
|
- histogramInfoList.add(histogramInfo);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (!meters.isEmpty()) {
|
|
|
- for (Map.Entry<String, Meter> entry : meters.entrySet()) {
|
|
|
- MeterInfo meterInfo = getMeterInfo(entry.getKey(), entry.getValue());
|
|
|
- meterInfoList.add(meterInfo);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (!timers.isEmpty()) {
|
|
|
- for (Map.Entry<String, Timer> entry : timers.entrySet()) {
|
|
|
- TimerInfo timerInfo = getTimerInfo(entry.getKey(), entry.getValue());
|
|
|
- timerInfoList.add(timerInfo);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- reportInfo = info;
|
|
|
- }
|
|
|
-
|
|
|
- private MeterInfo getMeterInfo(String key, Meter meter) {
|
|
|
-
|
|
|
- MeterInfo info = new MeterInfo();
|
|
|
- info.setKey(key);
|
|
|
- info.setRateUnit(getRateUnit());
|
|
|
-
|
|
|
- if (isEnabled(MetricAttribute.COUNT)) {
|
|
|
- info.setCount(meter.getCount());
|
|
|
- }
|
|
|
- if (isEnabled(MetricAttribute.MEAN_RATE)) {
|
|
|
- info.setMeanRate(convertRate(meter.getMeanRate()));
|
|
|
- }
|
|
|
-
|
|
|
- if (isEnabled(MetricAttribute.M1_RATE)) {
|
|
|
- info.setOneMinuteRate(convertRate(meter.getOneMinuteRate()));
|
|
|
- }
|
|
|
- if (isEnabled(MetricAttribute.M5_RATE)) {
|
|
|
- info.setFiveMinuteRate(convertRate(meter.getFiveMinuteRate()));
|
|
|
- }
|
|
|
- if (isEnabled(MetricAttribute.M15_RATE)) {
|
|
|
- info.setFifteenMinuteRate(convertRate(meter.getFifteenMinuteRate()));
|
|
|
- }
|
|
|
-
|
|
|
- return info;
|
|
|
- }
|
|
|
-
|
|
|
- private HistogramInfo getHistogramInfo(String key, Histogram histogram) {
|
|
|
- Snapshot snapshot = histogram.getSnapshot();
|
|
|
- HistogramInfo info = new HistogramInfo();
|
|
|
- info.setKey(key);
|
|
|
-
|
|
|
- if (isEnabled(MetricAttribute.MIN)) {
|
|
|
- info.setMin(snapshot.getMin());
|
|
|
- }
|
|
|
- if (isEnabled(MetricAttribute.MAX)) {
|
|
|
- info.setMax(snapshot.getMax());
|
|
|
- }
|
|
|
- if (isEnabled(MetricAttribute.MEAN)) {
|
|
|
- info.setMean(snapshot.getMean());
|
|
|
- }
|
|
|
-
|
|
|
- if (isEnabled(MetricAttribute.P50)) {
|
|
|
- info.setP50(snapshot.getMedian());
|
|
|
- }
|
|
|
- if (isEnabled(MetricAttribute.P75)) {
|
|
|
- info.setP75(snapshot.get75thPercentile());
|
|
|
- }
|
|
|
- if (isEnabled(MetricAttribute.P95)) {
|
|
|
- info.setP95(snapshot.get95thPercentile());
|
|
|
- }
|
|
|
- if (isEnabled(MetricAttribute.P98)) {
|
|
|
- info.setP98(snapshot.get98thPercentile());
|
|
|
- }
|
|
|
- if (isEnabled(MetricAttribute.P99)) {
|
|
|
- info.setP99(snapshot.get99thPercentile());
|
|
|
- }
|
|
|
- if (isEnabled(MetricAttribute.P999)) {
|
|
|
- info.setP999(snapshot.get999thPercentile());
|
|
|
- }
|
|
|
-
|
|
|
- return info;
|
|
|
- }
|
|
|
-
|
|
|
- private TimerInfo getTimerInfo(String key, Timer timer) {
|
|
|
- final Snapshot snapshot = timer.getSnapshot();
|
|
|
- TimerInfo info = new TimerInfo();
|
|
|
- info.setKey(key);
|
|
|
- info.setRateUnit(getRateUnit());
|
|
|
- info.setDurationUnit(getDurationUnit());
|
|
|
-
|
|
|
- if (isEnabled(MetricAttribute.COUNT)) {
|
|
|
- info.setCount(timer.getCount());
|
|
|
- }
|
|
|
- if (isEnabled(MetricAttribute.MEAN_RATE)) {
|
|
|
- info.setMeanRate(convertRate(timer.getMeanRate()));
|
|
|
- }
|
|
|
-
|
|
|
- if (isEnabled(MetricAttribute.M1_RATE)) {
|
|
|
- info.setOneMinuteRate(convertRate(timer.getOneMinuteRate()));
|
|
|
- }
|
|
|
- if (isEnabled(MetricAttribute.M5_RATE)) {
|
|
|
- info.setFiveMinuteRate(convertRate(timer.getFiveMinuteRate()));
|
|
|
- }
|
|
|
- if (isEnabled(MetricAttribute.M15_RATE)) {
|
|
|
- info.setFifteenMinuteRate(convertRate(timer.getFifteenMinuteRate()));
|
|
|
- }
|
|
|
-
|
|
|
- if (isEnabled(MetricAttribute.MIN)) {
|
|
|
- info.setMin(convertDuration(snapshot.getMin()));
|
|
|
- }
|
|
|
- if (isEnabled(MetricAttribute.MAX)) {
|
|
|
- info.setMax(convertDuration(snapshot.getMax()));
|
|
|
- }
|
|
|
- if (isEnabled(MetricAttribute.MEAN)) {
|
|
|
- info.setMean(convertDuration(snapshot.getMean()));
|
|
|
- }
|
|
|
-
|
|
|
- if (isEnabled(MetricAttribute.P50)) {
|
|
|
- info.setP50(convertDuration(snapshot.getMedian()));
|
|
|
- }
|
|
|
- if (isEnabled(MetricAttribute.P75)) {
|
|
|
- info.setP75(convertDuration(snapshot.get75thPercentile()));
|
|
|
- }
|
|
|
- if (isEnabled(MetricAttribute.P95)) {
|
|
|
- info.setP95(convertDuration(snapshot.get95thPercentile()));
|
|
|
- }
|
|
|
- if (isEnabled(MetricAttribute.P98)) {
|
|
|
- info.setP98(convertDuration(snapshot.get98thPercentile()));
|
|
|
- }
|
|
|
- if (isEnabled(MetricAttribute.P99)) {
|
|
|
- info.setP99(convertDuration(snapshot.get99thPercentile()));
|
|
|
- }
|
|
|
- if (isEnabled(MetricAttribute.P999)) {
|
|
|
- info.setP999(convertDuration(snapshot.get999thPercentile()));
|
|
|
- }
|
|
|
-
|
|
|
- return info;
|
|
|
- }
|
|
|
-
|
|
|
- private boolean isEnabled(MetricAttribute type) {
|
|
|
- return !getDisabledMetricAttributes().contains(type);
|
|
|
- }
|
|
|
-
|
|
|
- public ReportInfo getReportInfo() {
|
|
|
- return reportInfo;
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
+// package cn.com.qmth.examcloud.web.actuator;
|
|
|
+//
|
|
|
+// import com.codahale.metrics.Timer;
|
|
|
+// import com.codahale.metrics.*;
|
|
|
+// import com.google.common.collect.Lists;
|
|
|
+//
|
|
|
+// import java.util.*;
|
|
|
+// import java.util.concurrent.ScheduledExecutorService;
|
|
|
+// import java.util.concurrent.TimeUnit;
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 数据报告
|
|
|
+// *
|
|
|
+// * @author WANGWEI
|
|
|
+// * @date 2019年7月25日
|
|
|
+// * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
|
|
|
+// */
|
|
|
+// public class DataReportor extends ScheduledReporter {
|
|
|
+//
|
|
|
+// public static Builder forRegistry(MetricRegistry registry) {
|
|
|
+// return new Builder(registry);
|
|
|
+// }
|
|
|
+//
|
|
|
+// public static class Builder {
|
|
|
+//
|
|
|
+// private final MetricRegistry registry;
|
|
|
+//
|
|
|
+// private Clock clock;
|
|
|
+//
|
|
|
+// private TimeUnit rateUnit;
|
|
|
+//
|
|
|
+// private TimeUnit durationUnit;
|
|
|
+//
|
|
|
+// private MetricFilter filter;
|
|
|
+//
|
|
|
+// private ScheduledExecutorService executor;
|
|
|
+//
|
|
|
+// private boolean shutdownExecutorOnStop;
|
|
|
+//
|
|
|
+// private Set<MetricAttribute> disabledMetricAttributes;
|
|
|
+//
|
|
|
+// private Builder(MetricRegistry registry) {
|
|
|
+// this.registry = registry;
|
|
|
+// this.clock = Clock.defaultClock();
|
|
|
+// this.rateUnit = TimeUnit.SECONDS;
|
|
|
+// this.durationUnit = TimeUnit.MILLISECONDS;
|
|
|
+// this.filter = MetricFilter.ALL;
|
|
|
+// this.executor = null;
|
|
|
+// this.shutdownExecutorOnStop = true;
|
|
|
+// disabledMetricAttributes = Collections.emptySet();
|
|
|
+// }
|
|
|
+//
|
|
|
+// public Builder shutdownExecutorOnStop(boolean shutdownExecutorOnStop) {
|
|
|
+// this.shutdownExecutorOnStop = shutdownExecutorOnStop;
|
|
|
+// return this;
|
|
|
+// }
|
|
|
+//
|
|
|
+// public Builder scheduleOn(ScheduledExecutorService executor) {
|
|
|
+// this.executor = executor;
|
|
|
+// return this;
|
|
|
+// }
|
|
|
+//
|
|
|
+// public Builder withClock(Clock clock) {
|
|
|
+// this.clock = clock;
|
|
|
+// return this;
|
|
|
+// }
|
|
|
+//
|
|
|
+// public Builder convertRatesTo(TimeUnit rateUnit) {
|
|
|
+// this.rateUnit = rateUnit;
|
|
|
+// return this;
|
|
|
+// }
|
|
|
+//
|
|
|
+// public Builder convertDurationsTo(TimeUnit durationUnit) {
|
|
|
+// this.durationUnit = durationUnit;
|
|
|
+// return this;
|
|
|
+// }
|
|
|
+//
|
|
|
+// public Builder filter(MetricFilter filter) {
|
|
|
+// this.filter = filter;
|
|
|
+// return this;
|
|
|
+// }
|
|
|
+//
|
|
|
+// public Builder disabledMetricAttributes(Set<MetricAttribute> disabledMetricAttributes) {
|
|
|
+// this.disabledMetricAttributes = disabledMetricAttributes;
|
|
|
+// return this;
|
|
|
+// }
|
|
|
+//
|
|
|
+// public DataReportor build() {
|
|
|
+// return new DataReportor(registry, clock, rateUnit, durationUnit, filter, executor,
|
|
|
+// shutdownExecutorOnStop, disabledMetricAttributes);
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+//
|
|
|
+// private final Clock clock;
|
|
|
+//
|
|
|
+// private ReportInfo reportInfo;
|
|
|
+//
|
|
|
+// private DataReportor(MetricRegistry registry, Clock clock, TimeUnit rateUnit,
|
|
|
+// TimeUnit durationUnit, MetricFilter filter, ScheduledExecutorService executor,
|
|
|
+// boolean shutdownExecutorOnStop, Set<MetricAttribute> disabledMetricAttributes) {
|
|
|
+// super(registry, "data-reporter", filter, rateUnit, durationUnit, executor,
|
|
|
+// shutdownExecutorOnStop, disabledMetricAttributes);
|
|
|
+// this.clock = clock;
|
|
|
+// }
|
|
|
+//
|
|
|
+// @Override
|
|
|
+// @SuppressWarnings("rawtypes")
|
|
|
+// public void report(SortedMap<String, Gauge> gauges, SortedMap<String, Counter> counters,
|
|
|
+// SortedMap<String, Histogram> histograms, SortedMap<String, Meter> meters,
|
|
|
+// SortedMap<String, Timer> timers) {
|
|
|
+//
|
|
|
+// ReportInfo info = new ReportInfo();
|
|
|
+// info.setDateTime(new Date(clock.getTime()));
|
|
|
+//
|
|
|
+// final List<HistogramInfo> histogramInfoList = Lists.newArrayList();
|
|
|
+// final List<TimerInfo> timerInfoList = Lists.newArrayList();
|
|
|
+// final List<MeterInfo> meterInfoList = Lists.newArrayList();
|
|
|
+// info.setHistogramInfoList(histogramInfoList);
|
|
|
+// info.setMeterInfoList(meterInfoList);
|
|
|
+// info.setTimerInfoList(timerInfoList);
|
|
|
+//
|
|
|
+// if (!histograms.isEmpty()) {
|
|
|
+// for (Map.Entry<String, Histogram> entry : histograms.entrySet()) {
|
|
|
+// HistogramInfo histogramInfo = getHistogramInfo(entry.getKey(), entry.getValue());
|
|
|
+// histogramInfoList.add(histogramInfo);
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (!meters.isEmpty()) {
|
|
|
+// for (Map.Entry<String, Meter> entry : meters.entrySet()) {
|
|
|
+// MeterInfo meterInfo = getMeterInfo(entry.getKey(), entry.getValue());
|
|
|
+// meterInfoList.add(meterInfo);
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (!timers.isEmpty()) {
|
|
|
+// for (Map.Entry<String, Timer> entry : timers.entrySet()) {
|
|
|
+// TimerInfo timerInfo = getTimerInfo(entry.getKey(), entry.getValue());
|
|
|
+// timerInfoList.add(timerInfo);
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// reportInfo = info;
|
|
|
+// }
|
|
|
+//
|
|
|
+// private MeterInfo getMeterInfo(String key, Meter meter) {
|
|
|
+//
|
|
|
+// MeterInfo info = new MeterInfo();
|
|
|
+// info.setKey(key);
|
|
|
+// info.setRateUnit(getRateUnit());
|
|
|
+//
|
|
|
+// if (isEnabled(MetricAttribute.COUNT)) {
|
|
|
+// info.setCount(meter.getCount());
|
|
|
+// }
|
|
|
+// if (isEnabled(MetricAttribute.MEAN_RATE)) {
|
|
|
+// info.setMeanRate(convertRate(meter.getMeanRate()));
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (isEnabled(MetricAttribute.M1_RATE)) {
|
|
|
+// info.setOneMinuteRate(convertRate(meter.getOneMinuteRate()));
|
|
|
+// }
|
|
|
+// if (isEnabled(MetricAttribute.M5_RATE)) {
|
|
|
+// info.setFiveMinuteRate(convertRate(meter.getFiveMinuteRate()));
|
|
|
+// }
|
|
|
+// if (isEnabled(MetricAttribute.M15_RATE)) {
|
|
|
+// info.setFifteenMinuteRate(convertRate(meter.getFifteenMinuteRate()));
|
|
|
+// }
|
|
|
+//
|
|
|
+// return info;
|
|
|
+// }
|
|
|
+//
|
|
|
+// private HistogramInfo getHistogramInfo(String key, Histogram histogram) {
|
|
|
+// Snapshot snapshot = histogram.getSnapshot();
|
|
|
+// HistogramInfo info = new HistogramInfo();
|
|
|
+// info.setKey(key);
|
|
|
+//
|
|
|
+// if (isEnabled(MetricAttribute.MIN)) {
|
|
|
+// info.setMin(snapshot.getMin());
|
|
|
+// }
|
|
|
+// if (isEnabled(MetricAttribute.MAX)) {
|
|
|
+// info.setMax(snapshot.getMax());
|
|
|
+// }
|
|
|
+// if (isEnabled(MetricAttribute.MEAN)) {
|
|
|
+// info.setMean(snapshot.getMean());
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (isEnabled(MetricAttribute.P50)) {
|
|
|
+// info.setP50(snapshot.getMedian());
|
|
|
+// }
|
|
|
+// if (isEnabled(MetricAttribute.P75)) {
|
|
|
+// info.setP75(snapshot.get75thPercentile());
|
|
|
+// }
|
|
|
+// if (isEnabled(MetricAttribute.P95)) {
|
|
|
+// info.setP95(snapshot.get95thPercentile());
|
|
|
+// }
|
|
|
+// if (isEnabled(MetricAttribute.P98)) {
|
|
|
+// info.setP98(snapshot.get98thPercentile());
|
|
|
+// }
|
|
|
+// if (isEnabled(MetricAttribute.P99)) {
|
|
|
+// info.setP99(snapshot.get99thPercentile());
|
|
|
+// }
|
|
|
+// if (isEnabled(MetricAttribute.P999)) {
|
|
|
+// info.setP999(snapshot.get999thPercentile());
|
|
|
+// }
|
|
|
+//
|
|
|
+// return info;
|
|
|
+// }
|
|
|
+//
|
|
|
+// private TimerInfo getTimerInfo(String key, Timer timer) {
|
|
|
+// final Snapshot snapshot = timer.getSnapshot();
|
|
|
+// TimerInfo info = new TimerInfo();
|
|
|
+// info.setKey(key);
|
|
|
+// info.setRateUnit(getRateUnit());
|
|
|
+// info.setDurationUnit(getDurationUnit());
|
|
|
+//
|
|
|
+// if (isEnabled(MetricAttribute.COUNT)) {
|
|
|
+// info.setCount(timer.getCount());
|
|
|
+// }
|
|
|
+// if (isEnabled(MetricAttribute.MEAN_RATE)) {
|
|
|
+// info.setMeanRate(convertRate(timer.getMeanRate()));
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (isEnabled(MetricAttribute.M1_RATE)) {
|
|
|
+// info.setOneMinuteRate(convertRate(timer.getOneMinuteRate()));
|
|
|
+// }
|
|
|
+// if (isEnabled(MetricAttribute.M5_RATE)) {
|
|
|
+// info.setFiveMinuteRate(convertRate(timer.getFiveMinuteRate()));
|
|
|
+// }
|
|
|
+// if (isEnabled(MetricAttribute.M15_RATE)) {
|
|
|
+// info.setFifteenMinuteRate(convertRate(timer.getFifteenMinuteRate()));
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (isEnabled(MetricAttribute.MIN)) {
|
|
|
+// info.setMin(convertDuration(snapshot.getMin()));
|
|
|
+// }
|
|
|
+// if (isEnabled(MetricAttribute.MAX)) {
|
|
|
+// info.setMax(convertDuration(snapshot.getMax()));
|
|
|
+// }
|
|
|
+// if (isEnabled(MetricAttribute.MEAN)) {
|
|
|
+// info.setMean(convertDuration(snapshot.getMean()));
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (isEnabled(MetricAttribute.P50)) {
|
|
|
+// info.setP50(convertDuration(snapshot.getMedian()));
|
|
|
+// }
|
|
|
+// if (isEnabled(MetricAttribute.P75)) {
|
|
|
+// info.setP75(convertDuration(snapshot.get75thPercentile()));
|
|
|
+// }
|
|
|
+// if (isEnabled(MetricAttribute.P95)) {
|
|
|
+// info.setP95(convertDuration(snapshot.get95thPercentile()));
|
|
|
+// }
|
|
|
+// if (isEnabled(MetricAttribute.P98)) {
|
|
|
+// info.setP98(convertDuration(snapshot.get98thPercentile()));
|
|
|
+// }
|
|
|
+// if (isEnabled(MetricAttribute.P99)) {
|
|
|
+// info.setP99(convertDuration(snapshot.get99thPercentile()));
|
|
|
+// }
|
|
|
+// if (isEnabled(MetricAttribute.P999)) {
|
|
|
+// info.setP999(convertDuration(snapshot.get999thPercentile()));
|
|
|
+// }
|
|
|
+//
|
|
|
+// return info;
|
|
|
+// }
|
|
|
+//
|
|
|
+// private boolean isEnabled(MetricAttribute type) {
|
|
|
+// return !getDisabledMetricAttributes().contains(type);
|
|
|
+// }
|
|
|
+//
|
|
|
+// public ReportInfo getReportInfo() {
|
|
|
+// return reportInfo;
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|