mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
first working version
This commit is contained in:
parent
4e9c369304
commit
1eba54e3ce
@ -189,6 +189,10 @@ public class NBCreators {
|
|||||||
base.addListener(histoStatsLogger);
|
base.addListener(histoStatsLogger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SqliteReporter sqliteReporter(NBComponent component, String url, long millis, MetricInstanceFilter filter) {
|
||||||
|
return new SqliteReporter(component, url, millis, filter);
|
||||||
|
}
|
||||||
|
|
||||||
public static class Log4jReporterBuilder {
|
public static class Log4jReporterBuilder {
|
||||||
private final NBComponent component;
|
private final NBComponent component;
|
||||||
private Logger logger = LogManager.getLogger(Log4JMetricsReporter.class);
|
private Logger logger = LogManager.getLogger(Log4JMetricsReporter.class);
|
||||||
|
@ -441,6 +441,12 @@ public class NBCLI implements Function<String[], Integer>, NBLabeledElement {
|
|||||||
new CsvReporter(session, Path.of(cfg.file), cfg.millis, filter);
|
new CsvReporter(session, Path.of(cfg.file), cfg.millis, filter);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
options.wantsReportSqliteTo().ifPresent(cfg -> {
|
||||||
|
MetricInstanceFilter filter = new MetricInstanceFilter();
|
||||||
|
filter.addPattern(cfg.pattern);
|
||||||
|
session.create().sqliteReporter(session, cfg.url, cfg.millis, filter);
|
||||||
|
});
|
||||||
|
|
||||||
options.wantsReportPromPushTo().ifPresent(cfg -> {
|
options.wantsReportPromPushTo().ifPresent(cfg -> {
|
||||||
String[] words = cfg.split(",");
|
String[] words = cfg.split(",");
|
||||||
String uri;
|
String uri;
|
||||||
|
@ -142,6 +142,7 @@ public class NBCLIOptions {
|
|||||||
private final static String NBIO_CACHE_NO_VERIFY = "--nbio-cache-no-verify";
|
private final static String NBIO_CACHE_NO_VERIFY = "--nbio-cache-no-verify";
|
||||||
private final static String NBIO_CACHE_DIR = "--nbio-cache-dir";
|
private final static String NBIO_CACHE_DIR = "--nbio-cache-dir";
|
||||||
private final static String NBIO_CACHE_MAX_RETRIES = "--nbio-cache-max-retries";
|
private final static String NBIO_CACHE_MAX_RETRIES = "--nbio-cache-max-retries";
|
||||||
|
private static final String REPORT_SQLITE_TO = "--report-sqlite-to";
|
||||||
|
|
||||||
// private static final String DEFAULT_CONSOLE_LOGGING_PATTERN = "%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n";
|
// private static final String DEFAULT_CONSOLE_LOGGING_PATTERN = "%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n";
|
||||||
|
|
||||||
@ -163,6 +164,7 @@ public class NBCLIOptions {
|
|||||||
private String reportGraphiteTo;
|
private String reportGraphiteTo;
|
||||||
private String reportPromPushTo;
|
private String reportPromPushTo;
|
||||||
private String reportCsvTo;
|
private String reportCsvTo;
|
||||||
|
private String reportSqliteTo;
|
||||||
private int reportInterval = 10;
|
private int reportInterval = 10;
|
||||||
private String metricsPrefix = "nosqlbench";
|
private String metricsPrefix = "nosqlbench";
|
||||||
private String wantsMetricsForActivity;
|
private String wantsMetricsForActivity;
|
||||||
@ -607,6 +609,10 @@ public class NBCLIOptions {
|
|||||||
arglist.removeFirst();
|
arglist.removeFirst();
|
||||||
this.reportCsvTo = arglist.removeFirst();
|
this.reportCsvTo = arglist.removeFirst();
|
||||||
break;
|
break;
|
||||||
|
case NBCLIOptions.REPORT_SQLITE_TO:
|
||||||
|
arglist.removeFirst();
|
||||||
|
this.reportSqliteTo = arglist.removeFirst();
|
||||||
|
break;
|
||||||
case NBCLIOptions.SUMMARY:
|
case NBCLIOptions.SUMMARY:
|
||||||
arglist.removeFirst();
|
arglist.removeFirst();
|
||||||
this.reportSummaryTo = "stdout:0";
|
this.reportSummaryTo = "stdout:0";
|
||||||
@ -898,6 +904,10 @@ public class NBCLIOptions {
|
|||||||
return Optional.ofNullable(this.reportCsvTo).map(LoggerConfigData::new);
|
return Optional.ofNullable(this.reportCsvTo).map(LoggerConfigData::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Optional<SqliteConfigData> wantsReportSqliteTo() {
|
||||||
|
return Optional.ofNullable(this.reportSqliteTo).map(SqliteConfigData::new);
|
||||||
|
}
|
||||||
|
|
||||||
public Path getLogsDirectory() {
|
public Path getLogsDirectory() {
|
||||||
return Path.of(this.logsDirectory);
|
return Path.of(this.logsDirectory);
|
||||||
}
|
}
|
||||||
@ -980,6 +990,39 @@ public class NBCLIOptions {
|
|||||||
return this.wantsWorkloadsList;
|
return this.wantsWorkloadsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class SqliteConfigData {
|
||||||
|
public String url;
|
||||||
|
public String pattern = ".*";
|
||||||
|
public long millis = 30000L;
|
||||||
|
|
||||||
|
public SqliteConfigData(final String sqlReporterSpec) {
|
||||||
|
final String[] words = sqlReporterSpec.split(",");
|
||||||
|
switch (words.length) {
|
||||||
|
case 3:
|
||||||
|
if (words[2] != null && !words[2].isEmpty()) {
|
||||||
|
this.millis = Unit.msFor(words[2]).orElseThrow(() ->
|
||||||
|
new RuntimeException("Unable to parse interval spec:" + words[2] + '\''));
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
this.pattern = words[1].isEmpty() ? this.pattern : words[1];
|
||||||
|
case 1:
|
||||||
|
this.url = words[0];
|
||||||
|
if (this.url.isEmpty())
|
||||||
|
throw new RuntimeException("You must not specify a sqlite db file here for recording data.");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new RuntimeException(
|
||||||
|
NBCLIOptions.REPORT_SQLITE_TO +
|
||||||
|
" options must be in either 'db,filter,interval' or 'db,filter' or 'db' format"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public String getUrl() {
|
||||||
|
return this.url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class LoggerConfigData {
|
public static class LoggerConfigData {
|
||||||
public String file;
|
public String file;
|
||||||
public String pattern = ".*";
|
public String pattern = ".*";
|
||||||
|
Loading…
Reference in New Issue
Block a user