mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
console friendly metrics summary
This commit is contained in:
parent
146686e0b5
commit
3f65a05463
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
package io.nosqlbench.engine.core;
|
package io.nosqlbench.engine.core;
|
||||||
|
|
||||||
|
import com.codahale.metrics.ConsoleReporter;
|
||||||
import com.codahale.metrics.MetricFilter;
|
import com.codahale.metrics.MetricFilter;
|
||||||
import io.nosqlbench.engine.api.metrics.ActivityMetrics;
|
import io.nosqlbench.engine.api.metrics.ActivityMetrics;
|
||||||
import io.nosqlbench.engine.core.logging.Log4JMetricsReporter;
|
import io.nosqlbench.engine.core.logging.Log4JMetricsReporter;
|
||||||
@ -44,6 +45,7 @@ public class ScenarioResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void reportToLog() {
|
public void reportToLog() {
|
||||||
|
|
||||||
logger.info("-- BEGIN METRICS DETAIL --");
|
logger.info("-- BEGIN METRICS DETAIL --");
|
||||||
Log4JMetricsReporter reporter = Log4JMetricsReporter.forRegistry(ActivityMetrics.getMetricRegistry())
|
Log4JMetricsReporter reporter = Log4JMetricsReporter.forRegistry(ActivityMetrics.getMetricRegistry())
|
||||||
.convertDurationsTo(TimeUnit.MICROSECONDS)
|
.convertDurationsTo(TimeUnit.MICROSECONDS)
|
||||||
@ -56,13 +58,23 @@ public class ScenarioResult {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void reportToConsole() {
|
||||||
|
ConsoleReporter consoleReporter = ConsoleReporter.forRegistry(ActivityMetrics.getMetricRegistry())
|
||||||
|
.convertDurationsTo(TimeUnit.MICROSECONDS)
|
||||||
|
.convertRatesTo(TimeUnit.SECONDS)
|
||||||
|
.filter(MetricFilter.ALL)
|
||||||
|
.outputTo(System.out)
|
||||||
|
.build();
|
||||||
|
consoleReporter.report();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public Optional<Exception> getException() {
|
public Optional<Exception> getException() {
|
||||||
return Optional.ofNullable(exception);
|
return Optional.ofNullable(exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rethrowIfError() {
|
public void rethrowIfError() {
|
||||||
if (exception!=null) {
|
if (exception != null) {
|
||||||
if (exception instanceof RuntimeException) {
|
if (exception instanceof RuntimeException) {
|
||||||
throw ((RuntimeException) exception);
|
throw ((RuntimeException) exception);
|
||||||
} else {
|
} else {
|
||||||
@ -74,4 +86,5 @@ public class ScenarioResult {
|
|||||||
public String getIOLog() {
|
public String getIOLog() {
|
||||||
return this.iolog;
|
return this.iolog;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -67,9 +67,11 @@ public class ScenariosResults {
|
|||||||
|
|
||||||
if (oresult != null) {
|
if (oresult != null) {
|
||||||
oresult.reportToLog();
|
oresult.reportToLog();
|
||||||
|
oresult.reportToConsole();
|
||||||
} else {
|
} else {
|
||||||
logger.error(scenario.getScenarioName() + ": incomplete (missing result)");
|
logger.error(scenario.getScenarioName() + ": incomplete (missing result)");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user