mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
enable label filtering and validation
This commit is contained in:
@@ -282,6 +282,7 @@ public class NBCLI implements Function<String[], Integer>, NBLabeledElement {
|
||||
NBIO.addGlobalIncludes(options.wantsIncludes());
|
||||
|
||||
ActivityMetrics.setHdrDigits(options.getHdrDigits());
|
||||
ActivityMetrics.setLabelValidator(options.getAnnotateLabelSpec());
|
||||
|
||||
if (options.wantsBasicHelp()) {
|
||||
System.out.println(this.loadHelpFile("basic.md"));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
* Copyright (c) 2022-2023 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -466,6 +466,11 @@ public class NBCLIArgsFile {
|
||||
} else {
|
||||
args.add(line);
|
||||
}
|
||||
if ((args.peekLast().startsWith("\"") && args.peekLast().endsWith("\""))||(
|
||||
(args.peekLast().startsWith("'") && args.peekLast().endsWith("'")))) {
|
||||
String unquote = args.removeLast();
|
||||
args.addLast(unquote.substring(1, unquote.length()-1));
|
||||
}
|
||||
}
|
||||
return args;
|
||||
}
|
||||
|
||||
@@ -54,6 +54,8 @@ public class NBCLIOptions {
|
||||
private static final String ANNOTATE_EVENTS = "--annotate";
|
||||
|
||||
private static final String ANNOTATE_LABELSPEC = "--annotate-labelspec";
|
||||
private static final String METRICS_LABELSPEC = "--metrics-labelspec";
|
||||
private static final String LABELSPEC = "--labelspec";
|
||||
private static final String ANNOTATORS_CONFIG = "--annotators";
|
||||
private static final String PROMPUSH_CONFIG = "--prompush";
|
||||
|
||||
@@ -86,6 +88,7 @@ public class NBCLIOptions {
|
||||
|
||||
private static final String SET_LABELS = "--set-labels";
|
||||
private static final String ADD_LABELS = "--add-labels";
|
||||
private static final String ADD_LABEL = "--add-label";
|
||||
|
||||
// Execution
|
||||
private static final String EXPORT_CYCLE_LOG = "--export-cycle-log";
|
||||
@@ -201,10 +204,14 @@ public class NBCLIOptions {
|
||||
private boolean wantsListCommands;
|
||||
private boolean wantsListApps;
|
||||
private boolean dedicatedVerificationLogger;
|
||||
private boolean wantsConsoleMetrics =true;
|
||||
private String annotateLabelSpec="";
|
||||
private boolean wantsConsoleMetrics = true;
|
||||
private String annotateLabelSpec = "";
|
||||
private String metricsLabelSpec = "";
|
||||
|
||||
public boolean wantsLoggedMetrics() {
|
||||
return this.wantsConsoleMetrics;
|
||||
}
|
||||
|
||||
public boolean wantsLoggedMetrics() { return this.wantsConsoleMetrics; }
|
||||
public boolean isWantsListApps() {
|
||||
return this.wantsListApps;
|
||||
}
|
||||
@@ -265,6 +272,10 @@ public class NBCLIOptions {
|
||||
return annotateLabelSpec;
|
||||
}
|
||||
|
||||
public String getMetricsLabelSpec() {
|
||||
return metricsLabelSpec;
|
||||
}
|
||||
|
||||
public enum Mode {
|
||||
ParseGlobalsOnly,
|
||||
ParseAllOptions
|
||||
@@ -491,22 +502,34 @@ public class NBCLIOptions {
|
||||
String setLabelData = arglist.removeFirst();
|
||||
setLabels(setLabelData);
|
||||
break;
|
||||
case NBCLIOptions.ADD_LABELS:
|
||||
case ADD_LABELS:
|
||||
case ADD_LABEL:
|
||||
arglist.removeFirst();
|
||||
String addLabeldata = arglist.removeFirst();
|
||||
addLabels(addLabeldata);
|
||||
break;
|
||||
case NBCLIOptions.ENABLE_LOGGED_METRICS:
|
||||
arglist.removeFirst();
|
||||
this.wantsConsoleMetrics =true;
|
||||
this.wantsConsoleMetrics = true;
|
||||
break;
|
||||
case NBCLIOptions.DISABLE_LOGGED_METRICS:
|
||||
arglist.removeFirst();
|
||||
this.wantsConsoleMetrics =false;
|
||||
this.wantsConsoleMetrics = false;
|
||||
break;
|
||||
case LABELSPEC:
|
||||
arglist.removeFirst();
|
||||
String labelspec = this.readWordOrThrow(arglist, "label validator specification for metric labels and annotation tags");
|
||||
this.annotateLabelSpec = labelspec;
|
||||
this.metricsLabelSpec = labelspec;
|
||||
break;
|
||||
case ANNOTATE_LABELSPEC:
|
||||
arglist.removeFirst();
|
||||
this.annotateLabelSpec = this.readWordOrThrow(arglist, "labels validator specification");
|
||||
this.annotateLabelSpec = this.readWordOrThrow(arglist, "labels validator specification for annotation tags from labels");
|
||||
break;
|
||||
case METRICS_LABELSPEC:
|
||||
arglist.remove();
|
||||
this.metricsLabelSpec = this.readWordOrThrow(arglist, "labels validator specification for metric labels");
|
||||
break;
|
||||
default:
|
||||
nonincludes.addLast(arglist.removeFirst());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user