mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
squelch invalid parts of summary
This commit is contained in:
parent
d223e4c6c5
commit
c4ee38d22c
@ -28,12 +28,31 @@ import org.apache.logging.log4j.Logger;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashSet;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class ScenarioResult {
|
||||
|
||||
private final static Logger logger = LogManager.getLogger(ScenarioResult.class);
|
||||
public static final Set<MetricAttribute> INTERVAL_ONLY_METRICS = Set.of(
|
||||
MetricAttribute.MIN,
|
||||
MetricAttribute.MAX,
|
||||
MetricAttribute.MEAN,
|
||||
MetricAttribute.STDDEV,
|
||||
MetricAttribute.P50,
|
||||
MetricAttribute.P75,
|
||||
MetricAttribute.P95,
|
||||
MetricAttribute.P98,
|
||||
MetricAttribute.P99,
|
||||
MetricAttribute.P999);
|
||||
public static final Set<MetricAttribute> OVER_ONE_MINUTE_METRICS = Set.of(
|
||||
MetricAttribute.MEAN_RATE,
|
||||
MetricAttribute.M1_RATE,
|
||||
MetricAttribute.M5_RATE,
|
||||
MetricAttribute.M15_RATE
|
||||
);
|
||||
private final long startedAt;
|
||||
private final long endedAt;
|
||||
|
||||
@ -60,12 +79,17 @@ public class ScenarioResult {
|
||||
public String getSummaryReport() {
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
PrintStream ps = new PrintStream(os);
|
||||
ConsoleReporter consoleReporter = ConsoleReporter.forRegistry(ActivityMetrics.getMetricRegistry())
|
||||
ConsoleReporter.Builder builder = ConsoleReporter.forRegistry(ActivityMetrics.getMetricRegistry())
|
||||
.convertDurationsTo(TimeUnit.MICROSECONDS)
|
||||
.convertRatesTo(TimeUnit.SECONDS)
|
||||
.filter(MetricFilter.ALL)
|
||||
.outputTo(ps)
|
||||
.build();
|
||||
.outputTo(ps);
|
||||
Set<MetricAttribute> disabled = new HashSet<>(INTERVAL_ONLY_METRICS);
|
||||
if (this.getElapsedMillis()<60000) {
|
||||
disabled.addAll(OVER_ONE_MINUTE_METRICS);
|
||||
}
|
||||
builder.disabledMetricAttributes(disabled);
|
||||
ConsoleReporter consoleReporter = builder.build();
|
||||
consoleReporter.report();
|
||||
|
||||
ps.flush();
|
||||
@ -106,6 +130,9 @@ public class ScenarioResult {
|
||||
}
|
||||
|
||||
public void reportToLog() {
|
||||
logger.debug("-- WARNING: Metrics which are taken per-interval (like histograms) will not have --");
|
||||
logger.debug("-- active data on this last report. (The workload has already stopped.) Record --");
|
||||
logger.debug("-- metrics to an external format to see values for each reporting interval. --");
|
||||
logger.debug("-- BEGIN METRICS DETAIL --");
|
||||
Log4JMetricsReporter reporter = Log4JMetricsReporter.forRegistry(ActivityMetrics.getMetricRegistry())
|
||||
.withLoggingLevel(Log4JMetricsReporter.LoggingLevel.DEBUG)
|
||||
@ -139,7 +166,7 @@ public class ScenarioResult {
|
||||
});
|
||||
|
||||
printStream.println("-- BEGIN NON-ZERO metric counts (run longer for full report):");
|
||||
printStream.print(sb.toString());
|
||||
printStream.print(sb);
|
||||
printStream.println("-- END NON-ZERO metric counts:");
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user